load-constant-mem.ll 322 B

12345678910111213
  1. ; RUN: opt < %s -basicaa -gvn -instcombine -S | grep "ret i32 0"
  2. ; PR4189
  3. @G = external constant [4 x i32]
  4. define i32 @test(i8* %p, i32 %i) nounwind {
  5. entry:
  6. %P = getelementptr [4 x i32], [4 x i32]* @G, i32 0, i32 %i
  7. %A = load i32, i32* %P
  8. store i8 4, i8* %p
  9. %B = load i32, i32* %P
  10. %C = sub i32 %A, %B
  11. ret i32 %C
  12. }