llvm.org GIT mirror llvm / 21f76da
[Tests] Strengthen LICM test corpus to show alignment striping. (part 2) This should have been part of r355110, but my brain isn't quite awake yet, despite the coffee. Per the original submit comment... Doing scalar promotion w/o being able to prove the alignment of the hoisted load or sunk store is a bug. Update tests to actually show the alignment so that impact of the patch which fixes this can be seen. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355111 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 6 months ago
1 changed file(s) with 31 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
6666 ret void
6767 }
6868
69 ;; We can promote if the load can be proven safe to speculate, and the
70 ;; store safe to sink, even if the the store *isn't* must execute.
6971 define void @test3(i1 zeroext %y) uwtable {
7072 ; CHECK-LABEL: @test3
7173 entry:
8890 for.cond.cleanup:
8991 ; CHECK-LABEL: for.cond.cleanup:
9092 ; CHECK: store i32 %add.lcssa, i32* %a, align 1
93 ; CHECK-NEXT: ret void
94 ret void
95 }
96
97 ;; Same as test3, but with unordered atomics
98 ;; FIXME: doing the transform w/o alignment here is wrong since we're
99 ;; creating an unaligned atomic which we may not be able to lower.
100 define void @test3b(i1 zeroext %y) uwtable {
101 ; CHECK-LABEL: @test3
102 entry:
103 ; CHECK-LABEL: entry:
104 ; CHECK-NEXT: %a = alloca i32
105 ; CHECK-NEXT: %a.promoted = load atomic i32, i32* %a unordered, align 1
106 %a = alloca i32
107 br label %for.body
108
109 for.body:
110 %i.03 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
111 %0 = load atomic i32, i32* %a unordered, align 4
112 %add = add nsw i32 %0, 1
113 tail call void @f()
114 store atomic i32 %add, i32* %a unordered, align 4
115 %inc = add nuw nsw i32 %i.03, 1
116 %exitcond = icmp eq i32 %inc, 10000
117 br i1 %exitcond, label %for.cond.cleanup, label %for.body
118
119 for.cond.cleanup:
120 ; CHECK-LABEL: for.cond.cleanup:
121 ; CHECK: store atomic i32 %add.lcssa, i32* %a unordered, align 1
91122 ; CHECK-NEXT: ret void
92123 ret void
93124 }