Displaying 1 result from an estimated 1 matches for "arrayidx_cast".
2018 Nov 18
3
Dependence Analysis bug or undefined behavior?
Hi,
Does this kind of IR have "undefined behavior" under LLVM semantics or is it acceptable?
(TLDR: a store of i64 at offset n, followed by a load of i32 at offset n+1.)
define void @foo(i32* %A, i64 %n) {
entry:
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %n
%arrayidx_cast = bitcast i32* %arrayidx to i64*
store i64 0, i64* %arrayidx_cast, align 4
%add1 = add i64 %n, 1
%arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %add1
%0 = load i32, i32* %arrayidx2, align 4
ret void
}
The result of Dependence Analysis is:
opt -analyze -da BitCasts.ll
Printing ana...