[llvm] 73eec80 - [SimplifyCFG] Make some tests more robust (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 28 05:31:55 PDT 2023
Author: Nikita Popov
Date: 2023-06-28T14:31:48+02:00
New Revision: 73eec8092e3d155e8745cb4e030aa1923ccab8fd
URL: https://github.com/llvm/llvm-project/commit/73eec8092e3d155e8745cb4e030aa1923ccab8fd
DIFF: https://github.com/llvm/llvm-project/commit/73eec8092e3d155e8745cb4e030aa1923ccab8fd.diff
LOG: [SimplifyCFG] Make some tests more robust (NFC)
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
index 8b592af2be7a4..26107965a1a8b 100644
--- a/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
+++ b/llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
@@ -301,27 +301,27 @@ define i32 @test10(i1 zeroext %flag, i32 %x, ptr %y, ptr %s) {
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[FLAG:%.*]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: [[DUMMY:%.*]] = add i32 [[X:%.*]], 5
+; CHECK-NEXT: call void @bar(i32 5)
; CHECK-NEXT: br label [[IF_END:%.*]]
; CHECK: if.else:
-; CHECK-NEXT: [[DUMMY1:%.*]] = add i32 [[X]], 6
+; CHECK-NEXT: call void @bar(i32 6)
; CHECK-NEXT: [[GEPB:%.*]] = getelementptr inbounds [[STRUCT_ANON:%.*]], ptr [[S:%.*]], i32 0, i32 1
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
; CHECK-NEXT: [[GEPB_SINK:%.*]] = phi ptr [ [[GEPB]], [[IF_ELSE]] ], [ [[S]], [[IF_THEN]] ]
-; CHECK-NEXT: store volatile i32 [[X]], ptr [[GEPB_SINK]], align 4
+; CHECK-NEXT: store volatile i32 [[X:%.*]], ptr [[GEPB_SINK]], align 4
; CHECK-NEXT: ret i32 1
;
entry:
br i1 %flag, label %if.then, label %if.else
if.then:
- %dummy = add i32 %x, 5
+ call void @bar(i32 5)
store volatile i32 %x, ptr %s
br label %if.end
if.else:
- %dummy1 = add i32 %x, 6
+ call void @bar(i32 6)
%gepb = getelementptr inbounds %struct.anon, ptr %s, i32 0, i32 1
store volatile i32 %x, ptr %gepb
br label %if.end
@@ -522,10 +522,10 @@ define i32 @test15(i1 zeroext %flag, i32 %w, i32 %x, i32 %y, ptr %s) {
; CHECK-NEXT: entry:
; CHECK-NEXT: br i1 [[FLAG:%.*]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: [[DUMMY:%.*]] = add i32 [[X:%.*]], 1
+; CHECK-NEXT: call void @bar(i32 1)
; CHECK-NEXT: br label [[IF_END:%.*]]
; CHECK: if.else:
-; CHECK-NEXT: [[DUMMY2:%.*]] = add i32 [[X]], 4
+; CHECK-NEXT: call void @bar(i32 4)
; CHECK-NEXT: [[GEPB:%.*]] = getelementptr inbounds [[STRUCT_ANON:%.*]], ptr [[S:%.*]], i32 0, i32 1
; CHECK-NEXT: br label [[IF_END]]
; CHECK: if.end:
@@ -540,14 +540,14 @@ entry:
br i1 %flag, label %if.then, label %if.else
if.then:
- %dummy = add i32 %x, 1
+ call void @bar(i32 1)
%sv1 = load i32, ptr %s
%ext1 = zext i32 %sv1 to i64
%cmp1 = icmp eq i64 %ext1, 56
br label %if.end
if.else:
- %dummy2 = add i32 %x, 4
+ call void @bar(i32 4)
%gepb = getelementptr inbounds %struct.anon, ptr %s, i32 0, i32 1
%sv2 = load i32, ptr %gepb
%ext2 = zext i32 %sv2 to i64
diff --git a/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll b/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
index 451812c453a8d..41486c5935a39 100644
--- a/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
+++ b/llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
@@ -5,7 +5,7 @@
@0 = external hidden constant [5 x %0], align 4
-define void @foo(i32) nounwind ssp !dbg !0 {
+define i1 @foo(i32) nounwind ssp !dbg !0 {
; CHECK-LABEL: @foo(
; CHECK-NEXT: Entry:
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[TMP0:%.*]], 0
@@ -19,12 +19,12 @@ define void @foo(i32) nounwind ssp !dbg !0 {
; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds [5 x %0], ptr @[[GLOB0:[0-9]+]], i32 0, i32 [[TMP0]]
; CHECK-NEXT: [[TMP7:%.*]] = icmp eq ptr [[TMP6]], null
; CHECK-NEXT: [[OR_COND2:%.*]] = select i1 [[TMP5]], i1 true, i1 [[TMP7]]
-; CHECK-NEXT: br i1 [[OR_COND2]], label [[COMMON_RET]], label [[BB4:%.*]]
-; CHECK: common.ret:
-; CHECK-NEXT: ret void
-; CHECK: BB4:
; CHECK-NEXT: [[TMP8:%.*]] = icmp slt i32 [[TMP0]], 0
+; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[OR_COND2]], i1 false, i1 [[TMP8]]
; CHECK-NEXT: br label [[COMMON_RET]]
+; CHECK: common.ret:
+; CHECK-NEXT: [[COMMON_RET_OP:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[SPEC_SELECT]], [[BB2]] ]
+; CHECK-NEXT: ret i1 [[COMMON_RET_OP]]
;
Entry:
%1 = icmp slt i32 %0, 0, !dbg !5
@@ -49,10 +49,10 @@ BB3: ; preds = %BB2
BB4: ; preds = %BB3
%8 = icmp slt i32 %0, 0, !dbg !5
- ret void, !dbg !14
+ ret i1 %8, !dbg !14
BB5: ; preds = %BB3, %BB2, %BB1, %Entry
- ret void, !dbg !14
+ ret i1 false, !dbg !14
}
declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone
More information about the llvm-commits
mailing list