Displaying 1 result from an estimated 1 matches for "_z5readav".
Did you mean:
_z5readab
2015 Jan 26
2
[LLVMdev] LLVM introduces racy read - Unsafe transformation?
...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 <filename>.opt.bc -S
Target
-------
define i32 @_Z5readAv() #3 {
entry:
%0 = load i8* @flag, align 1
%1 = and i8 %0, 1
%tobool = icmp eq i8 %1, 0
%2 = load i32* @a, align 4
%. = select i1 %tobool, i32 0, i32 %2
ret i32 %.
}
Consider the following function writeA() runs in parallel with readA().
void writeA(){
a = 42;
}
The source program...