2003-04-22-GEPProblem.ll 396 B

1234567891011121314
  1. ; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s
  2. ; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
  3. define i32 @test(i32 *%Ptr, i64 %V) {
  4. ; CHECK: sub i32 %X, %Y
  5. %P2 = getelementptr i32, i32* %Ptr, i64 1
  6. %P1 = getelementptr i32, i32* %Ptr, i64 %V
  7. %X = load i32, i32* %P1
  8. store i32 5, i32* %P2
  9. %Y = load i32, i32* %P1
  10. %Z = sub i32 %X, %Y
  11. ret i32 %Z
  12. }