2
0

2007-08-27-VolatileLoadsStores.ll 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ; RUN: opt < %s -O3 -S | grep volatile | count 3
  2. ; PR1520
  3. ; Don't promote load volatiles/stores. This is really needed to handle setjmp/lonjmp properly.
  4. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
  5. target triple = "i686-pc-linux-gnu"
  6. %struct.__jmp_buf_tag = type { [6 x i32], i32, %struct.__sigset_t }
  7. %struct.__sigset_t = type { [32 x i32] }
  8. @j = external global [1 x %struct.__jmp_buf_tag] ; <[1 x %struct.__jmp_buf_tag]*> [#uses=1]
  9. define i32 @f() {
  10. entry:
  11. %retval = alloca i32, align 4 ; <i32*> [#uses=2]
  12. %v = alloca i32, align 4 ; <i32*> [#uses=3]
  13. %tmp = alloca i32, align 4 ; <i32*> [#uses=3]
  14. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  15. store volatile i32 0, i32* %v, align 4
  16. %tmp1 = call i32 @_setjmp( %struct.__jmp_buf_tag* getelementptr ([1 x %struct.__jmp_buf_tag], [1 x %struct.__jmp_buf_tag]* @j, i32 0, i32 0) ) ; <i32> [#uses=1]
  17. %tmp2 = icmp ne i32 %tmp1, 0 ; <i1> [#uses=1]
  18. %tmp23 = zext i1 %tmp2 to i8 ; <i8> [#uses=1]
  19. %toBool = icmp ne i8 %tmp23, 0 ; <i1> [#uses=1]
  20. br i1 %toBool, label %bb, label %bb5
  21. bb: ; preds = %entry
  22. %tmp4 = load volatile i32, i32* %v, align 4 ; <i32> [#uses=1]
  23. store i32 %tmp4, i32* %tmp, align 4
  24. br label %bb6
  25. bb5: ; preds = %entry
  26. store volatile i32 1, i32* %v, align 4
  27. call void @g( )
  28. store i32 0, i32* %tmp, align 4
  29. br label %bb6
  30. bb6: ; preds = %bb5, %bb
  31. %tmp7 = load i32, i32* %tmp, align 4 ; <i32> [#uses=1]
  32. store i32 %tmp7, i32* %retval, align 4
  33. br label %return
  34. return: ; preds = %bb6
  35. %retval8 = load i32, i32* %retval ; <i32> [#uses=1]
  36. ret i32 %retval8
  37. }
  38. declare i32 @_setjmp(%struct.__jmp_buf_tag*) returns_twice
  39. declare void @g()