A bunch of read_imageXX bult-ins declared in opencl_1.2.h and opencl.h has attribute((const)) (translated to readnone in LLVM IR) which instructs the compiler what these functions do not access memory which is wrong by definition. Proper attribute is attribute((pure)) that means the functions do not modify memory. It seem both (SPIR 1.2 and SPIR-V) generators have this bug.
A bunch of read_imageXX bult-ins declared in opencl_1.2.h and opencl.h has attribute((const)) (translated to readnone in LLVM IR) which instructs the compiler what these functions do not access memory which is wrong by definition. Proper attribute is attribute((pure)) that means the functions do not modify memory. It seem both (SPIR 1.2 and SPIR-V) generators have this bug.