[LICM] Check opt output in test (NFC)
authorNikita Popov <npopov@redhat.com>
Wed, 6 Jul 2022 14:21:05 +0000 (16:21 +0200)
committerNikita Popov <npopov@redhat.com>
Wed, 6 Jul 2022 14:21:36 +0000 (16:21 +0200)
Check what the test actually produces, not just that it doesn't
crash.

llvm/test/Transforms/LICM/callbr-crash.ll

index 923e832..c9a3136 100644 (file)
@@ -1,18 +1,31 @@
-; RUN: opt -licm -disable-output < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -licm < %s | FileCheck %s
 
 define i32 @j() {
+; CHECK-LABEL: @j(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    br label [[FOR_COND:%.*]]
+; CHECK:       for.cond:
+; CHECK-NEXT:    callbr void asm sideeffect "", "i,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@j, [[FOR_END:%.*]]))
+; CHECK-NEXT:    to label [[COND_TRUE_I:%.*]] [label %for.end]
+; CHECK:       cond.true.i:
+; CHECK-NEXT:    br i1 true, label [[FOR_END]], label [[FOR_COND]]
+; CHECK:       for.end:
+; CHECK-NEXT:    [[PHI:%.*]] = phi i32 [ 0, [[COND_TRUE_I]] ], [ undef, [[FOR_COND]] ]
+; CHECK-NEXT:    ret i32 [[PHI]]
+;
 entry:
   br label %for.cond
 
 for.cond:                                         ; preds = %cond.true.i, %entry
   callbr void asm sideeffect "", "i,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@j, %for.end))
-          to label %cond.true.i [label %for.end]
+  to label %cond.true.i [label %for.end]
 
 cond.true.i:                                      ; preds = %for.cond
   %asmresult1.i.i = extractvalue { i8, i32 } zeroinitializer, 1
   br i1 undef, label %for.end, label %for.cond
 
 for.end:                                          ; preds = %cond.true.i, %for.cond
-  %asmresult1.i.i2 = phi i32 [ %asmresult1.i.i, %cond.true.i ], [ undef, %for.cond ]
-  ret i32 undef
+  %phi = phi i32 [ %asmresult1.i.i, %cond.true.i ], [ undef, %for.cond ]
+  ret i32 %phi
 }