[NFC][Clang][CodegenOpenCL] Fix test not to rely on volatile store not being removed

This commit is contained in:
Roman Lebedev 2021-07-09 14:13:34 +03:00
parent 1440d4564f
commit 329f8197ef
No known key found for this signature in database
GPG key ID: 083C3EBB4A1689E0

View file

@ -3,11 +3,10 @@
// This is initially assumed convergent, but can be deduced to not require it.
// CHECK-LABEL: define{{.*}} spir_func void @non_convfun() local_unnamed_addr #0
// CHECK-LABEL: define{{.*}} spir_func void @non_convfun(i32* %p) local_unnamed_addr #0
// CHECK: ret void
__attribute__((noinline))
void non_convfun(void) {
volatile int* p;
void non_convfun(volatile int* p) {
*p = 0;
}
@ -28,29 +27,29 @@ void g(void);
// non_convfun();
// }
//
// CHECK-LABEL: define{{.*}} spir_func void @test_merge_if(i32 %a) local_unnamed_addr #1 {
// CHECK-LABEL: define{{.*}} spir_func void @test_merge_if(i32 %a, i32* %p) local_unnamed_addr #1 {
// CHECK: %[[tobool:.+]] = icmp eq i32 %a, 0
// CHECK: br i1 %[[tobool]], label %[[if_end3_critedge:.+]], label %[[if_then:.+]]
// CHECK: [[if_then]]:
// CHECK: tail call spir_func void @f()
// CHECK: tail call spir_func void @non_convfun()
// CHECK: tail call spir_func void @non_convfun(i32* %p)
// CHECK: tail call spir_func void @g()
// CHECK: br label %[[if_end3:.+]]
// CHECK: [[if_end3_critedge]]:
// CHECK: tail call spir_func void @non_convfun()
// CHECK: tail call spir_func void @non_convfun(i32* %p)
// CHECK: br label %[[if_end3]]
// CHECK: [[if_end3]]:
// CHECK: ret void
void test_merge_if(int a) {
void test_merge_if(int a, volatile int* p) {
if (a) {
f();
}
non_convfun();
non_convfun(p);
if (a) {
g();
}