search for: _z5readab

Displaying 2 results from an estimated 2 matches for "_z5readab".

2015 Jan 26
3
[LLVMdev] LLVM introduces racy read - Unsafe transformation?
...flag) { int r=0; if(flag) { r = a; } return r; } void writeA(){ a = 42; } int main() { bool flag = false; thread first (writeA); thread second (readA, flag); first.join(); second.join(); return 0; } The generated LLVM IR ; Function Attrs: nounwind readonly uwtable define i32 @_Z5readAb(i1 zeroext %flag) #3 { entry: %0 = load i32* @a, align 4 %. = select i1 %flag, i32 %0, i32 0 ret i32 %. } ; Function Attrs: nounwind uwtable define void @_Z6writeAv() #4 { entry: store i32 42, i32* @a, align 4 ret void } : In the generated IR load(a) is independent of flag value which...
2015 Jan 26
2
[LLVMdev] LLVM introduces racy read - Unsafe transformation?
Hi, I am looking for thoughts on the following LLVM transformation. Consider the following transformation which replaces conditional load(a) with load(a);select instructions. Source -------- int a; bool flag; int readA() { int r=0; if(flag) { r = a; } return r; } Command -------- clang++ -std=c++11 -pthread -emit-llvm <filename>.cpp -S;opt -O3 <filename>.ll -o