[llvm] d74e365 - [Coroutines] Avoid branch on undef UB in test (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 3 04:53:49 PST 2023


Author: Nikita Popov
Date: 2023-01-03T13:53:41+01:00
New Revision: d74e36572a5110b388fcbc6188dabdfffc18fe4f

URL: https://github.com/llvm/llvm-project/commit/d74e36572a5110b388fcbc6188dabdfffc18fe4f
DIFF: https://github.com/llvm/llvm-project/commit/d74e36572a5110b388fcbc6188dabdfffc18fe4f.diff

LOG: [Coroutines] Avoid branch on undef UB in test (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/Coroutines/coro-split-recursive.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/Coroutines/coro-split-recursive.ll b/llvm/test/Transforms/Coroutines/coro-split-recursive.ll
index 95073ae8bd49c..4d15598b632d4 100644
--- a/llvm/test/Transforms/Coroutines/coro-split-recursive.ll
+++ b/llvm/test/Transforms/Coroutines/coro-split-recursive.ll
@@ -9,6 +9,8 @@ declare token @llvm.coro.save(i8*)
 
 declare i8 @llvm.coro.suspend(token, i1)
 
+declare i1 @get.i1()
+
 ; CHECK-LABEL: define void @foo()
 ; CHECK-LABEL: define {{.*}}void @foo.resume(
 ; CHECK: call void @foo()
@@ -20,12 +22,13 @@ entry:
   %0 = bitcast i32* %__promise to i8*
   %1 = call token @llvm.coro.id(i32 16, i8* %0, i8* null, i8* null)
   %2 = call i8* @llvm.coro.begin(token %1, i8* null)
-  br i1 undef, label %if.then154, label %init.suspend
+  %c = call i1 @get.i1()
+  br i1 %c, label %if.then154, label %init.suspend
 
 init.suspend:                                     ; preds = %entry
   %save = call token @llvm.coro.save(i8* null)
-  %3 = call i8 @llvm.coro.suspend(token %save, i1 false)
-  %cond = icmp eq i8 %3, 0
+  %i3 = call i8 @llvm.coro.suspend(token %save, i1 false)
+  %cond = icmp eq i8 %i3, 0
   br i1 %cond, label %if.then154, label %invoke.cont163
 
 if.then154:                                       ; preds = %init.suspend, %entry


        


More information about the llvm-commits mailing list