Displaying 2 results from an estimated 2 matches for "_z6writeav".
2015 Jan 26
3
[LLVMdev] LLVM introduces racy read - Unsafe transformation?
...);
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 is not the
case in the source program. Hence there is an introduced race between
load(a) and store(a) operations when readA() and writeA() runs
concurrently.
Regards,
soha...
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