[llvm] b6909fe - JumpThreading: Modernize some test checking
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 27 09:41:34 PST 2022
Author: Matt Arsenault
Date: 2022-11-27T12:41:28-05:00
New Revision: b6909fe9ca1789db98c3481977468d33e9886182
URL: https://github.com/llvm/llvm-project/commit/b6909fe9ca1789db98c3481977468d33e9886182
DIFF: https://github.com/llvm/llvm-project/commit/b6909fe9ca1789db98c3481977468d33e9886182.diff
LOG: JumpThreading: Modernize some test checking
Stop using tests with grep, or no output checks at all. Just use
FileCheck and generate checks. Also remove unnecessary requires
asserts.
Added:
Modified:
llvm/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll
llvm/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll
llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll
llvm/test/Transforms/JumpThreading/2012-07-19-NoSuccessorIndirectBr.ll
llvm/test/Transforms/JumpThreading/PR37745.ll
llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
llvm/test/Transforms/JumpThreading/branch-no-const.ll
llvm/test/Transforms/JumpThreading/compare.ll
llvm/test/Transforms/JumpThreading/ddt-crash.ll
llvm/test/Transforms/JumpThreading/ddt-crash2.ll
llvm/test/Transforms/JumpThreading/ddt-crash3.ll
llvm/test/Transforms/JumpThreading/ddt-crash4.ll
llvm/test/Transforms/JumpThreading/degenerate-phi.ll
llvm/test/Transforms/JumpThreading/landing-pad.ll
llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll
llvm/test/Transforms/JumpThreading/pr9331.ll
llvm/test/Transforms/JumpThreading/stale-loop-info-after-unfold-select.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll b/llvm/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll
index 05ca08766a24..f70caf3da131 100644
--- a/llvm/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll
+++ b/llvm/test/Transforms/JumpThreading/2008-11-27-EntryMunge.ll
@@ -1,13 +1,19 @@
-; RUN: opt < %s -passes=jump-threading -S | grep "ret i32 0"
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -passes=jump-threading -S < %s | FileCheck %s
; PR3138
+; Check that there's a ret 0
define i32 @jt() {
+; CHECK-LABEL: @jt(
+; CHECK-NEXT: bb3:
+; CHECK-NEXT: ret i32 0
+;
entry:
- br i1 true, label %bb3, label %bb
+ br i1 true, label %bb3, label %bb
bb: ; preds = %entry
- unreachable
+ unreachable
bb3: ; preds = %entry
- ret i32 0
+ ret i32 0
}
diff --git a/llvm/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll b/llvm/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll
index 4203000ff3ab..2ef21d0636a4 100644
--- a/llvm/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll
+++ b/llvm/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll
@@ -1,8 +1,31 @@
-; RUN: opt -S -passes=jump-threading < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -jump-threading < %s | FileCheck %s
; PR9446
; Just check that it doesn't crash
define void @int327() nounwind {
+; CHECK-LABEL: @int327(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: unreachable
+; CHECK: for.cond:
+; CHECK-NEXT: [[TOBOOL3:%.*]] = icmp eq i8 undef, 0
+; CHECK-NEXT: br i1 [[TOBOOL3]], label [[FOR_COND23:%.*]], label [[FOR_COND4:%.*]]
+; CHECK: for.cond4:
+; CHECK-NEXT: br label [[FOR_COND:%.*]]
+; CHECK: for.cond23:
+; CHECK-NEXT: [[CONV321:%.*]] = phi i32 [ [[CONV32:%.*]], [[FOR_BODY28:%.*]] ], [ 0, [[FOR_COND]] ], [ [[CONV321]], [[FOR_COND23]] ]
+; CHECK-NEXT: [[L_266_0:%.*]] = phi i32 [ [[PHITMP:%.*]], [[FOR_BODY28]] ], [ 0, [[FOR_COND]] ], [ 0, [[FOR_COND23]] ]
+; CHECK-NEXT: [[CMP26:%.*]] = icmp eq i32 [[L_266_0]], 0
+; CHECK-NEXT: br i1 [[CMP26]], label [[FOR_BODY28]], label [[FOR_COND23]]
+; CHECK: for.body28:
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[CONV321]], 1
+; CHECK-NEXT: [[CONV32]] = zext i8 undef to i32
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[L_266_0]], 1
+; CHECK-NEXT: [[PHITMP]] = and i32 [[ADD]], 255
+; CHECK-NEXT: br label [[FOR_COND23]]
+; CHECK: if.end43:
+; CHECK-NEXT: ret void
+;
entry:
unreachable
diff --git a/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll b/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll
index 393d499307df..7c3c00f1e1e0 100644
--- a/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll
+++ b/llvm/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll
@@ -1,4 +1,5 @@
-; RUN: opt -passes=jump-threading < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
; <rdar://problem/9284786>
%0 = type <{ i64, i16, i64, i8, i8 }>
@@ -6,6 +7,22 @@
@g_338 = external global %0, align 8
define void @func_1() nounwind ssp {
+; CHECK-LABEL: @func_1(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret void
+; CHECK: for.cond1177:
+; CHECK-NEXT: [[INC1187:%.*]] = add nsw i32 0, 1
+; CHECK-NEXT: [[CMP1179:%.*]] = icmp slt i32 [[INC1187]], 5
+; CHECK-NEXT: br i1 [[CMP1179]], label [[FOR_COND1177:%.*]], label [[LAND_RHS1320:%.*]]
+; CHECK: land.rhs1320:
+; CHECK-NEXT: [[TMP1324:%.*]] = load volatile i64, ptr getelementptr inbounds ([[TMP0:%.*]], ptr @g_338, i64 0, i32 2), align 1
+; CHECK-NEXT: br label [[IF_END_I:%.*]]
+; CHECK: if.end.i:
+; CHECK-NEXT: [[TOBOOL_PR_I:%.*]] = phi i1 [ false, [[IF_END_I]] ], [ false, [[LAND_RHS1320]] ]
+; CHECK-NEXT: br i1 [[TOBOOL_PR_I]], label [[RETURN:%.*]], label [[IF_END_I]]
+; CHECK: return:
+; CHECK-NEXT: ret void
+;
entry:
ret void
diff --git a/llvm/test/Transforms/JumpThreading/2012-07-19-NoSuccessorIndirectBr.ll b/llvm/test/Transforms/JumpThreading/2012-07-19-NoSuccessorIndirectBr.ll
index 2a4b4e3efa7f..a11735e5af71 100644
--- a/llvm/test/Transforms/JumpThreading/2012-07-19-NoSuccessorIndirectBr.ll
+++ b/llvm/test/Transforms/JumpThreading/2012-07-19-NoSuccessorIndirectBr.ll
@@ -1,8 +1,13 @@
-; RUN: opt -S -passes=jump-threading < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
; PR 13405
; Just check that it doesn't crash / assert
define i32 @f() nounwind {
+; CHECK-LABEL: @f(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: indirectbr ptr undef, []
+;
entry:
indirectbr ptr undef, []
}
diff --git a/llvm/test/Transforms/JumpThreading/PR37745.ll b/llvm/test/Transforms/JumpThreading/PR37745.ll
index 8c846369d14c..f71aaab9eb63 100644
--- a/llvm/test/Transforms/JumpThreading/PR37745.ll
+++ b/llvm/test/Transforms/JumpThreading/PR37745.ll
@@ -1,6 +1,17 @@
-; RUN: opt -passes=jump-threading -verify-each -S -mtriple=x86_64-- -o - %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading -verify-each -mtriple=x86_64-- < %s | FileCheck %s
define void @foo() {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: B:
+; CHECK-NEXT: [[Z:%.*]] = add i32 undef, 1
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[Z]], 0
+; CHECK-NEXT: br i1 [[CMP]], label [[EXIT:%.*]], label [[B_THREAD:%.*]]
+; CHECK: B.thread:
+; CHECK-NEXT: br label [[EXIT]]
+; CHECK: exit:
+; CHECK-NEXT: ret void
+;
entry:
br i1 false, label %A, label %B
diff --git a/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll b/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
index 32873248bee7..ba3fca8a50e9 100644
--- a/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
+++ b/llvm/test/Transforms/JumpThreading/aa-crash-phi-no-args.ll
@@ -1,7 +1,18 @@
-; REQUIRES: asserts
-; RUN: opt -passes=jump-threading -aa-pipeline basic-aa -S -disable-output %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading -aa-pipeline basic-aa < %s | FileCheck %s
define void @foo(ptr %arg1, ptr %arg2) {
+; CHECK-LABEL: @foo(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: br label [[BB1:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[TMP:%.*]] = phi i1 [ false, [[BB24:%.*]] ], [ true, [[BB:%.*]] ]
+; CHECK-NEXT: br i1 [[TMP]], label [[BB8:%.*]], label [[BB24]]
+; CHECK: bb8:
+; CHECK-NEXT: ret void
+; CHECK: bb24:
+; CHECK-NEXT: br label [[BB1]]
+;
bb:
br label %bb1
diff --git a/llvm/test/Transforms/JumpThreading/branch-no-const.ll b/llvm/test/Transforms/JumpThreading/branch-no-const.ll
index 97e71a84a35b..a27ee7208785 100644
--- a/llvm/test/Transforms/JumpThreading/branch-no-const.ll
+++ b/llvm/test/Transforms/JumpThreading/branch-no-const.ll
@@ -1,8 +1,22 @@
-; RUN: opt < %s -passes=jump-threading -S | not grep phi
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
declare i8 @mcguffin()
+; Check there's no phi here.
define i32 @test(i1 %foo, i8 %b) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[A:%.*]] = call i8 @mcguffin()
+; CHECK-NEXT: br i1 [[FOO:%.*]], label [[RT:%.*]], label [[JT:%.*]]
+; CHECK: jt:
+; CHECK-NEXT: [[CMP_A:%.*]] = icmp eq i8 [[B:%.*]], [[A]]
+; CHECK-NEXT: br i1 [[CMP_A]], label [[RT]], label [[RF:%.*]]
+; CHECK: rt:
+; CHECK-NEXT: ret i32 7
+; CHECK: rf:
+; CHECK-NEXT: ret i32 8
+;
entry:
%a = call i8 @mcguffin()
br i1 %foo, label %bb1, label %bb2
@@ -12,8 +26,8 @@ bb2:
br label %jt
jt:
%x = phi i8 [%a, %bb1], [%b, %bb2]
- %A = icmp eq i8 %x, %a
- br i1 %A, label %rt, label %rf
+ %cmp.a = icmp eq i8 %x, %a
+ br i1 %cmp.a, label %rt, label %rf
rt:
ret i32 7
rf:
diff --git a/llvm/test/Transforms/JumpThreading/compare.ll b/llvm/test/Transforms/JumpThreading/compare.ll
index af39a541c15c..7e1622bd7ca7 100644
--- a/llvm/test/Transforms/JumpThreading/compare.ll
+++ b/llvm/test/Transforms/JumpThreading/compare.ll
@@ -1,30 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; There should be no phi nodes left.
-; RUN: opt < %s -passes=jump-threading -S | not grep "phi i32"
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
declare i32 @f1()
declare i32 @f2()
declare void @f3()
define i32 @test(i1 %cond) {
- br i1 %cond, label %T1, label %F1
+; CHECK-LABEL: @test(
+; CHECK-NEXT: br i1 [[COND:%.*]], label [[MERGE:%.*]], label [[MERGE_THREAD:%.*]]
+; CHECK: Merge.thread:
+; CHECK-NEXT: [[V2:%.*]] = call i32 @f2()
+; CHECK-NEXT: br label [[T2:%.*]]
+; CHECK: Merge:
+; CHECK-NEXT: [[V1:%.*]] = call i32 @f1()
+; CHECK-NEXT: [[A:%.*]] = icmp ne i32 [[V1]], 42
+; CHECK-NEXT: br i1 [[A]], label [[T2]], label [[F2:%.*]]
+; CHECK: T2:
+; CHECK-NEXT: call void @f3()
+; CHECK-NEXT: ret i32 1
+; CHECK: F2:
+; CHECK-NEXT: ret i32 0
+;
+ br i1 %cond, label %T1, label %F1
T1:
- %v1 = call i32 @f1()
- br label %Merge
+ %v1 = call i32 @f1()
+ br label %Merge
F1:
- %v2 = call i32 @f2()
- br label %Merge
+ %v2 = call i32 @f2()
+ br label %Merge
Merge:
- %B = phi i32 [%v1, %T1], [12, %F1]
- %A = icmp ne i32 %B, 42
- br i1 %A, label %T2, label %F2
+ %B = phi i32 [%v1, %T1], [12, %F1]
+ %A = icmp ne i32 %B, 42
+ br i1 %A, label %T2, label %F2
T2:
- call void @f3()
- ret i32 1
+ call void @f3()
+ ret i32 1
F2:
- ret i32 0
+ ret i32 0
}
diff --git a/llvm/test/Transforms/JumpThreading/ddt-crash.ll b/llvm/test/Transforms/JumpThreading/ddt-crash.ll
index 2491edba9497..e91b0b6f30c7 100644
--- a/llvm/test/Transforms/JumpThreading/ddt-crash.ll
+++ b/llvm/test/Transforms/JumpThreading/ddt-crash.ll
@@ -1,4 +1,5 @@
-; RUN: opt < %s -passes=jump-threading -disable-output
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
%struct.ham = type { i8, i8, i16, i32 }
%struct.zot = type { ptr }
@@ -11,6 +12,27 @@
declare i32 @wombat.2()
define void @blam() {
+; CHECK-LABEL: @blam(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr undef, align 4
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP]], 0
+; CHECK-NEXT: br i1 [[TMP1]], label [[BB11:%.*]], label [[BB2:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: [[TMP3:%.*]] = tail call i32 @wombat.2()
+; CHECK-NEXT: switch i32 [[TMP3]], label [[BB10:%.*]] [
+; CHECK-NEXT: i32 0, label [[BB7:%.*]]
+; CHECK-NEXT: i32 1, label [[BB10]]
+; CHECK-NEXT: i32 2, label [[BB10]]
+; CHECK-NEXT: i32 3, label [[BB11]]
+; CHECK-NEXT: ]
+; CHECK: bb7:
+; CHECK-NEXT: [[TMP6:%.*]] = tail call i32 @wombat.2()
+; CHECK-NEXT: br label [[BB11]]
+; CHECK: bb10:
+; CHECK-NEXT: ret void
+; CHECK: bb11:
+; CHECK-NEXT: ret void
+;
bb:
%tmp = load i32, ptr undef
%tmp1 = icmp eq i32 %tmp, 0
@@ -45,6 +67,84 @@ bb11:
}
define void @spam(ptr %arg) {
+; CHECK-LABEL: @spam(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: [[TMP:%.*]] = load i8, ptr undef, align 8
+; CHECK-NEXT: switch i8 [[TMP]], label [[BB11:%.*]] [
+; CHECK-NEXT: i8 1, label [[BB11]]
+; CHECK-NEXT: i8 2, label [[BB11]]
+; CHECK-NEXT: i8 3, label [[BB1:%.*]]
+; CHECK-NEXT: i8 4, label [[BB1]]
+; CHECK-NEXT: ]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[BB2:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ 0, [[BB1]] ], [ [[TMP3]], [[BB8:%.*]] ]
+; CHECK-NEXT: br label [[BB4:%.*]]
+; CHECK: bb4:
+; CHECK-NEXT: [[TMP5:%.*]] = load i8, ptr undef, align 8
+; CHECK-NEXT: switch i8 [[TMP5]], label [[BB11]] [
+; CHECK-NEXT: i8 0, label [[BB11]]
+; CHECK-NEXT: i8 1, label [[BB10:%.*]]
+; CHECK-NEXT: i8 2, label [[BB10]]
+; CHECK-NEXT: i8 3, label [[BB8]]
+; CHECK-NEXT: i8 4, label [[BB8]]
+; CHECK-NEXT: ]
+; CHECK: bb8:
+; CHECK-NEXT: [[TMP9:%.*]] = icmp eq ptr undef, [[ARG:%.*]]
+; CHECK-NEXT: br i1 [[TMP9]], label [[BB10]], label [[BB2]]
+; CHECK: bb10:
+; CHECK-NEXT: switch i32 [[TMP3]], label [[BB4]] [
+; CHECK-NEXT: i32 0, label [[BB16:%.*]]
+; CHECK-NEXT: i32 1, label [[BB11]]
+; CHECK-NEXT: i32 2, label [[BB12:%.*]]
+; CHECK-NEXT: ]
+; CHECK: bb11:
+; CHECK-NEXT: unreachable
+; CHECK: bb12:
+; CHECK-NEXT: [[TMP13:%.*]] = load ptr, ptr undef, align 8
+; CHECK-NEXT: br label [[BB16]]
+; CHECK: bb16:
+; CHECK-NEXT: [[TMP15:%.*]] = phi ptr [ [[TMP13]], [[BB12]] ], [ null, [[BB10]] ]
+; CHECK-NEXT: [[TMP17:%.*]] = load i8, ptr undef, align 8
+; CHECK-NEXT: switch i8 [[TMP17]], label [[BB11]] [
+; CHECK-NEXT: i8 0, label [[BB11]]
+; CHECK-NEXT: i8 11, label [[BB23:%.*]]
+; CHECK-NEXT: i8 12, label [[BB23]]
+; CHECK-NEXT: ]
+; CHECK: bb23:
+; CHECK-NEXT: [[TMP21:%.*]] = load ptr, ptr undef, align 8
+; CHECK-NEXT: [[TMP24:%.*]] = icmp eq ptr [[TMP21]], null
+; CHECK-NEXT: br i1 [[TMP24]], label [[BB37:%.*]], label [[BB25:%.*]]
+; CHECK: bb25:
+; CHECK-NEXT: [[TMP26:%.*]] = icmp eq ptr [[TMP15]], null
+; CHECK-NEXT: br i1 [[TMP26]], label [[BB41_THREAD:%.*]], label [[BB27:%.*]]
+; CHECK: bb27:
+; CHECK-NEXT: [[TMP28:%.*]] = load ptr, ptr undef, align 8
+; CHECK-NEXT: [[TMP29:%.*]] = icmp eq ptr [[TMP28]], [[TMP21]]
+; CHECK-NEXT: br i1 [[TMP29]], label [[BB41_THREAD]], label [[BB30:%.*]]
+; CHECK: bb30:
+; CHECK-NEXT: [[TMP32_PR:%.*]] = load i8, ptr undef, align 8
+; CHECK-NEXT: br label [[BB31:%.*]]
+; CHECK: bb31:
+; CHECK-NEXT: [[TMP32:%.*]] = phi i8 [ [[TMP32]], [[BB31]] ], [ [[TMP32_PR]], [[BB30]] ]
+; CHECK-NEXT: [[TMP33:%.*]] = icmp eq i8 [[TMP32]], 0
+; CHECK-NEXT: br i1 [[TMP33]], label [[BB31]], label [[BB37]]
+; CHECK: bb37:
+; CHECK-NEXT: [[TMP36:%.*]] = phi i1 [ false, [[BB23]] ], [ true, [[BB31]] ]
+; CHECK-NEXT: [[TMP38:%.*]] = icmp eq ptr [[TMP15]], null
+; CHECK-NEXT: br i1 [[TMP38]], label [[BB39:%.*]], label [[BB41:%.*]]
+; CHECK: bb39:
+; CHECK-NEXT: [[TMP364:%.*]] = phi i1 [ [[TMP36]], [[BB37]] ]
+; CHECK-NEXT: [[TMP40:%.*]] = load ptr, ptr @global, align 8
+; CHECK-NEXT: br i1 [[TMP364]], label [[BB41_THREAD]], label [[BB41_THREAD]]
+; CHECK: bb41:
+; CHECK-NEXT: [[TMP363:%.*]] = phi i1 [ [[TMP36]], [[BB37]] ]
+; CHECK-NEXT: br i1 [[TMP363]], label [[BB41_THREAD]], label [[BB41_THREAD]]
+; CHECK: bb41.thread:
+; CHECK-NEXT: [[TMP0:%.*]] = phi ptr [ undef, [[BB41]] ], [ undef, [[BB39]] ], [ undef, [[BB39]] ], [ undef, [[BB41]] ], [ undef, [[BB27]] ], [ undef, [[BB25]] ]
+; CHECK-NEXT: ret void
+;
bb:
%tmp = load i8, ptr undef, align 8
switch i8 %tmp, label %bb11 [
@@ -168,88 +268,165 @@ bb41:
declare i32 @foo(...)
define void @zot() align 2 personality ptr @foo {
+; CHECK-LABEL: @zot(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: invoke void @bar()
+; CHECK-NEXT: to label [[BB1:%.*]] unwind label [[BB3:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: invoke void @bar()
+; CHECK-NEXT: to label [[BB2:%.*]] unwind label [[BB4:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: invoke void @bar()
+; CHECK-NEXT: to label [[BB6:%.*]] unwind label [[BB17:%.*]]
+; CHECK: bb3:
+; CHECK-NEXT: [[TMP:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: unreachable
+; CHECK: bb4:
+; CHECK-NEXT: [[TMP5:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: unreachable
+; CHECK: bb6:
+; CHECK-NEXT: invoke void @bar()
+; CHECK-NEXT: to label [[BB7:%.*]] unwind label [[BB19:%.*]]
+; CHECK: bb7:
+; CHECK-NEXT: invoke void @bar()
+; CHECK-NEXT: to label [[BB10:%.*]] unwind label [[BB8:%.*]]
+; CHECK: bb8:
+; CHECK-NEXT: [[TMP9:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: unreachable
+; CHECK: bb10:
+; CHECK-NEXT: [[TMP11:%.*]] = load ptr, ptr undef, align 8
+; CHECK-NEXT: [[TMP12:%.*]] = invoke i32 [[TMP11]](ptr nonnull undef)
+; CHECK-NEXT: to label [[BB13:%.*]] unwind label [[BB21:%.*]]
+; CHECK: bb13:
+; CHECK-NEXT: invoke void @bar()
+; CHECK-NEXT: to label [[BB14:%.*]] unwind label [[BB30:%.*]]
+; CHECK: bb14:
+; CHECK-NEXT: [[TMP15:%.*]] = load ptr, ptr undef, align 8
+; CHECK-NEXT: [[TMP16:%.*]] = invoke i32 [[TMP15]](ptr nonnull undef)
+; CHECK-NEXT: to label [[BB26:%.*]] unwind label [[BB30_THREAD:%.*]]
+; CHECK: bb17:
+; CHECK-NEXT: [[TMP18:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: unreachable
+; CHECK: bb19:
+; CHECK-NEXT: [[TMP20:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: unreachable
+; CHECK: bb21:
+; CHECK-NEXT: [[TMP22:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: unreachable
+; CHECK: bb26:
+; CHECK-NEXT: [[TMP27:%.*]] = load ptr, ptr undef, align 8
+; CHECK-NEXT: [[TMP28:%.*]] = invoke i32 [[TMP27]](ptr nonnull undef)
+; CHECK-NEXT: to label [[BB29:%.*]] unwind label [[BB30_THREAD]]
+; CHECK: bb29:
+; CHECK-NEXT: unreachable
+; CHECK: bb30.thread:
+; CHECK-NEXT: [[LPAD_THR_COMM:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: br label [[BB32:%.*]]
+; CHECK: bb30:
+; CHECK-NEXT: [[LPAD_THR_COMM_SPLIT_LP:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr @global.1
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: br label [[BB32]]
+; CHECK: bb32:
+; CHECK-NEXT: unreachable
+;
bb:
invoke void @bar()
- to label %bb1 unwind label %bb3
+ to label %bb1 unwind label %bb3
bb1:
invoke void @bar()
- to label %bb2 unwind label %bb4
+ to label %bb2 unwind label %bb4
bb2:
invoke void @bar()
- to label %bb6 unwind label %bb17
+ to label %bb6 unwind label %bb17
bb3:
%tmp = landingpad { ptr, i32 }
- catch ptr @global.1
- catch ptr null
+ catch ptr @global.1
+ catch ptr null
unreachable
bb4:
%tmp5 = landingpad { ptr, i32 }
- catch ptr @global.1
- catch ptr null
+ catch ptr @global.1
+ catch ptr null
unreachable
bb6:
invoke void @bar()
- to label %bb7 unwind label %bb19
+ to label %bb7 unwind label %bb19
bb7:
invoke void @bar()
- to label %bb10 unwind label %bb8
+ to label %bb10 unwind label %bb8
bb8:
%tmp9 = landingpad { ptr, i32 }
- cleanup
- catch ptr @global.1
- catch ptr null
+ cleanup
+ catch ptr @global.1
+ catch ptr null
unreachable
bb10:
%tmp11 = load ptr, ptr undef, align 8
%tmp12 = invoke i32 %tmp11(ptr nonnull undef)
- to label %bb13 unwind label %bb21
+ to label %bb13 unwind label %bb21
bb13:
invoke void @bar()
- to label %bb14 unwind label %bb23
+ to label %bb14 unwind label %bb23
bb14:
%tmp15 = load ptr, ptr undef, align 8
%tmp16 = invoke i32 %tmp15(ptr nonnull undef)
- to label %bb26 unwind label %bb23
+ to label %bb26 unwind label %bb23
bb17:
%tmp18 = landingpad { ptr, i32 }
- catch ptr @global.1
- catch ptr null
+ catch ptr @global.1
+ catch ptr null
unreachable
bb19:
%tmp20 = landingpad { ptr, i32 }
- catch ptr @global.1
- catch ptr null
+ catch ptr @global.1
+ catch ptr null
unreachable
bb21:
%tmp22 = landingpad { ptr, i32 }
- catch ptr @global.1
- catch ptr null
+ catch ptr @global.1
+ catch ptr null
unreachable
bb23:
%tmp24 = phi ptr [ null, %bb26 ], [ null, %bb14 ], [ undef, %bb13 ]
%tmp25 = landingpad { ptr, i32 }
- catch ptr @global.1
- catch ptr null
+ catch ptr @global.1
+ catch ptr null
br label %bb30
bb26:
%tmp27 = load ptr, ptr undef, align 8
%tmp28 = invoke i32 %tmp27(ptr nonnull undef)
- to label %bb29 unwind label %bb23
+ to label %bb29 unwind label %bb23
bb29:
unreachable
diff --git a/llvm/test/Transforms/JumpThreading/ddt-crash2.ll b/llvm/test/Transforms/JumpThreading/ddt-crash2.ll
index dfe816553dde..ae43b3cbe621 100644
--- a/llvm/test/Transforms/JumpThreading/ddt-crash2.ll
+++ b/llvm/test/Transforms/JumpThreading/ddt-crash2.ll
@@ -1,8 +1,31 @@
-; RUN: opt < %s -passes=jump-threading -disable-output
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
%struct.aaa = type { i8 }
define void @chrome(ptr noalias sret(%struct.aaa) %arg) local_unnamed_addr #0 align 2 personality ptr @chrome2 {
+; CHECK-LABEL: @chrome(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr undef, align 4
+; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP]], 0
+; CHECK-NEXT: br i1 [[TMP1]], label [[BB2:%.*]], label [[BB13:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: [[TMP4:%.*]] = load i8, ptr [[ARG:%.*]], align 1
+; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i8 [[TMP4]], 0
+; CHECK-NEXT: br i1 [[TMP5]], label [[BB7:%.*]], label [[BB14:%.*]]
+; CHECK: bb7:
+; CHECK-NEXT: store i8 0, ptr [[ARG]], align 1
+; CHECK-NEXT: [[TMP9:%.*]] = icmp ne i8 0, 0
+; CHECK-NEXT: [[TMP10:%.*]] = select i1 [[TMP9]], i1 true, i1 false
+; CHECK-NEXT: br i1 [[TMP10]], label [[BB12:%.*]], label [[BB12]]
+; CHECK: bb12:
+; CHECK-NEXT: [[TMP94:%.*]] = phi i1 [ [[TMP9]], [[BB7]] ], [ [[TMP9]], [[BB7]] ]
+; CHECK-NEXT: br i1 [[TMP94]], label [[BB14]], label [[BB13]]
+; CHECK: bb13:
+; CHECK-NEXT: unreachable
+; CHECK: bb14:
+; CHECK-NEXT: ret void
+;
bb:
%tmp = load i32, ptr undef, align 4
%tmp1 = icmp eq i32 %tmp, 0
diff --git a/llvm/test/Transforms/JumpThreading/ddt-crash3.ll b/llvm/test/Transforms/JumpThreading/ddt-crash3.ll
index 0f99e6b76190..b37987bbf5cd 100644
--- a/llvm/test/Transforms/JumpThreading/ddt-crash3.ll
+++ b/llvm/test/Transforms/JumpThreading/ddt-crash3.ll
@@ -1,4 +1,5 @@
-; RUN: opt < %s -passes=jump-threading -disable-output -verify-dom-info
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading -verify-dom-info < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@@ -9,6 +10,20 @@ target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: norecurse noreturn nounwind uwtable
define void @hoge() local_unnamed_addr #0 {
+; CHECK-LABEL: @hoge(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: br label [[BB1:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[TMP:%.*]] = load i64, ptr @global, align 8, !tbaa [[TBAA1:![0-9]+]]
+; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP]], 0
+; CHECK-NEXT: br i1 [[TMP2]], label [[BB26:%.*]], label [[BB3:%.*]]
+; CHECK: bb3:
+; CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr @global.1, align 8, !tbaa [[TBAA1]]
+; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i64 [[TMP4]], 0
+; CHECK-NEXT: br i1 [[TMP5]], label [[BB26]], label [[BB26]]
+; CHECK: bb26:
+; CHECK-NEXT: br label [[BB1]]
+;
bb:
br label %bb1
diff --git a/llvm/test/Transforms/JumpThreading/ddt-crash4.ll b/llvm/test/Transforms/JumpThreading/ddt-crash4.ll
index e92412adec13..69eec7d5f6d8 100644
--- a/llvm/test/Transforms/JumpThreading/ddt-crash4.ll
+++ b/llvm/test/Transforms/JumpThreading/ddt-crash4.ll
@@ -1,7 +1,27 @@
-; RUN: opt < %s -passes=jump-threading -disable-output -verify-dom-info
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading -verify-dom-info < %s | FileCheck %s
+
@global = external global i64, align 8
define void @f() {
+; CHECK-LABEL: @f(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: br label [[BB1:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[TMP:%.*]] = load i64, ptr @global, align 8
+; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP]], 0
+; CHECK-NEXT: br i1 [[TMP2]], label [[BB27:%.*]], label [[BB3:%.*]]
+; CHECK: bb3:
+; CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr @global, align 8
+; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i64 [[TMP4]], 0
+; CHECK-NEXT: br i1 [[TMP5]], label [[BB23:%.*]], label [[BB23]]
+; CHECK: bb23:
+; CHECK-NEXT: br label [[BB26:%.*]]
+; CHECK: bb26:
+; CHECK-NEXT: br label [[BB1]]
+; CHECK: bb27:
+; CHECK-NEXT: br label [[BB26]]
+;
bb:
br label %bb1
diff --git a/llvm/test/Transforms/JumpThreading/degenerate-phi.ll b/llvm/test/Transforms/JumpThreading/degenerate-phi.ll
index 6e0c23345a87..a8060a23ac81 100644
--- a/llvm/test/Transforms/JumpThreading/degenerate-phi.ll
+++ b/llvm/test/Transforms/JumpThreading/degenerate-phi.ll
@@ -1,4 +1,5 @@
-; RUN: opt -passes=jump-threading -disable-output < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
; PR9112
; This is actually a test for value tracking. Jump threading produces
@@ -6,6 +7,19 @@
; The .ll parser won't let us write that directly since it's invalid code.
define void @func() nounwind {
+; CHECK-LABEL: @func(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[BB:%.*]]
+; CHECK: bb:
+; CHECK-NEXT: br label [[BB]]
+; CHECK: unreachable:
+; CHECK-NEXT: [[PHI:%.*]] = phi i16 [ [[ADD:%.*]], [[UNREACHABLE:%.*]] ], [ 0, [[NEXT:%.*]] ]
+; CHECK-NEXT: [[ADD]] = add i16 0, [[PHI]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[PHI]], 0
+; CHECK-NEXT: br i1 [[CMP]], label [[UNREACHABLE]], label [[NEXT]]
+; CHECK: next:
+; CHECK-NEXT: br label [[UNREACHABLE]]
+;
entry:
br label %bb
diff --git a/llvm/test/Transforms/JumpThreading/landing-pad.ll b/llvm/test/Transforms/JumpThreading/landing-pad.ll
index c92ae71dd7c4..29def94cdda0 100644
--- a/llvm/test/Transforms/JumpThreading/landing-pad.ll
+++ b/llvm/test/Transforms/JumpThreading/landing-pad.ll
@@ -1,4 +1,5 @@
-; RUN: opt -passes=jump-threading -disable-output < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
%class.E = type { ptr, %class.C }
%class.C = type { %class.A }
@@ -11,6 +12,13 @@
@_ZTI1D = external unnamed_addr constant { ptr, ptr, ptr }
define void @_ZN15EditCommandImpl5applyEv(ptr %this) uwtable align 2 {
+; CHECK-LABEL: @_ZN15EditCommandImpl5applyEv(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[VTABLE:%.*]] = load ptr, ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[VTABLE]], align 8
+; CHECK-NEXT: call void [[TMP0]](ptr [[THIS]])
+; CHECK-NEXT: ret void
+;
entry:
%vtable = load ptr, ptr %this, align 8
%0 = load ptr, ptr %vtable, align 8
@@ -19,6 +27,12 @@ entry:
}
define void @_ZN1DC1Ev(ptr nocapture %this) unnamed_addr uwtable align 2 {
+; CHECK-LABEL: @_ZN1DC1Ev(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: call void @_ZN24CompositeEditCommandImplC2Ev()
+; CHECK-NEXT: store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1D, i64 0, i64 2), ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: ret void
+;
entry:
call void @_ZN24CompositeEditCommandImplC2Ev()
store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1D, i64 0, i64 2), ptr %this, align 8
@@ -26,6 +40,12 @@ entry:
}
define void @_ZN1DC2Ev(ptr nocapture %this) unnamed_addr uwtable align 2 {
+; CHECK-LABEL: @_ZN1DC2Ev(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: call void @_ZN24CompositeEditCommandImplC2Ev()
+; CHECK-NEXT: store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1D, i64 0, i64 2), ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: ret void
+;
entry:
call void @_ZN24CompositeEditCommandImplC2Ev()
store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1D, i64 0, i64 2), ptr %this, align 8
@@ -35,15 +55,58 @@ entry:
declare void @_ZN24CompositeEditCommandImplC2Ev() #1
define void @_ZN1D7doApplyEv(ptr nocapture %this) unnamed_addr nounwind readnone uwtable align 2 {
+; CHECK-LABEL: @_ZN1D7doApplyEv(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret void
+;
entry:
ret void
}
define void @_Z3fn1v() uwtable personality ptr @__gxx_personality_v0 {
+; CHECK-LABEL: @_Z3fn1v(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CALL:%.*]] = call noalias ptr @_Znwm()
+; CHECK-NEXT: invoke void @_ZN24CompositeEditCommandImplC2Ev()
+; CHECK-NEXT: to label [[_ZN1DC1EV_EXIT:%.*]] unwind label [[LPAD:%.*]]
+; CHECK: _ZN1DC1Ev.exit:
+; CHECK-NEXT: store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1D, i64 0, i64 2), ptr [[CALL]], align 8
+; CHECK-NEXT: [[_REF_I_I_I:%.*]] = getelementptr inbounds i8, ptr [[CALL]], i64 8
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[_REF_I_I_I]], align 4
+; CHECK-NEXT: [[INC_I_I_I:%.*]] = add nsw i32 [[TMP0]], 1
+; CHECK-NEXT: store i32 [[INC_I_I_I]], ptr [[_REF_I_I_I]], align 4
+; CHECK-NEXT: invoke void @_ZN1D7doApplyEv(ptr [[CALL]])
+; CHECK-NEXT: to label [[_ZN15EDITCOMMANDIMPL5APPLYEV_EXIT:%.*]] unwind label [[LPAD1:%.*]]
+; CHECK: _ZN15EditCommandImpl5applyEv.exit:
+; CHECK-NEXT: invoke void @_ZN1D16deleteKeyPressedEv()
+; CHECK-NEXT: to label [[INVOKE_CONT7:%.*]] unwind label [[LPAD1]]
+; CHECK: invoke.cont7:
+; CHECK-NEXT: ret void
+; CHECK: lpad:
+; CHECK-NEXT: [[TMP1:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: call void @_ZdlPv()
+; CHECK-NEXT: unreachable
+; CHECK: lpad1:
+; CHECK-NEXT: [[TMP2:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[_REF_I_I_I]], align 4
+; CHECK-NEXT: [[TOBOOL_I_I_I:%.*]] = icmp eq i32 [[TMP3]], 0
+; CHECK-NEXT: br i1 [[TOBOOL_I_I_I]], label [[_ZN1BI1DED1EV_EXIT:%.*]], label [[DELETE_NOTNULL_I_I_I:%.*]]
+; CHECK: delete.notnull.i.i.i:
+; CHECK-NEXT: call void @_ZdlPv()
+; CHECK-NEXT: unreachable
+; CHECK: _ZN1BI1DED1Ev.exit:
+; CHECK-NEXT: resume { ptr, i32 } undef
+; CHECK: terminate.lpad:
+; CHECK-NEXT: [[TMP4:%.*]] = landingpad { ptr, i32 }
+; CHECK-NEXT: catch ptr null
+; CHECK-NEXT: unreachable
+;
entry:
%call = call noalias ptr @_Znwm() #8
invoke void @_ZN24CompositeEditCommandImplC2Ev()
- to label %_ZN1DC1Ev.exit unwind label %lpad
+ to label %_ZN1DC1Ev.exit unwind label %lpad
_ZN1DC1Ev.exit: ; preds = %entry
store ptr getelementptr inbounds ([3 x ptr], ptr @_ZTV1D, i64 0, i64 2), ptr %call, align 8
@@ -52,24 +115,24 @@ _ZN1DC1Ev.exit: ; preds = %entry
%inc.i.i.i = add nsw i32 %0, 1
store i32 %inc.i.i.i, ptr %_ref.i.i.i, align 4
invoke void @_ZN1D7doApplyEv(ptr %call)
- to label %_ZN15EditCommandImpl5applyEv.exit unwind label %lpad1
+ to label %_ZN15EditCommandImpl5applyEv.exit unwind label %lpad1
_ZN15EditCommandImpl5applyEv.exit: ; preds = %_ZN1DC1Ev.exit
invoke void @_ZN1D16deleteKeyPressedEv()
- to label %invoke.cont7 unwind label %lpad1
+ to label %invoke.cont7 unwind label %lpad1
invoke.cont7: ; preds = %_ZN15EditCommandImpl5applyEv.exit
ret void
lpad: ; preds = %entry
%1 = landingpad { ptr, i32 }
- cleanup
+ cleanup
call void @_ZdlPv() #9
unreachable
lpad1: ; preds = %_ZN1DC1Ev.exit, %_ZN15EditCommandImpl5applyEv.exit
%2 = landingpad { ptr, i32 }
- cleanup
+ cleanup
%3 = load i32, ptr %_ref.i.i.i, align 4
%tobool.i.i.i = icmp eq i32 %3, 0
br i1 %tobool.i.i.i, label %_ZN1BI1DED1Ev.exit, label %if.then.i.i.i
@@ -86,11 +149,20 @@ _ZN1BI1DED1Ev.exit: ; preds = %lpad1, %if.then.i.i
terminate.lpad: ; No predecessors!
%4 = landingpad { ptr, i32 }
- catch ptr null
+ catch ptr null
unreachable
}
define void @_ZN1BI1DEC1EPS0_(ptr nocapture %this, ptr %p1) unnamed_addr uwtable align 2 {
+; CHECK-LABEL: @_ZN1BI1DEC1EPS0_(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store ptr [[P1:%.*]], ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: [[_REF_I_I:%.*]] = getelementptr inbounds [[CLASS_D:%.*]], ptr [[P1]], i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[_REF_I_I]], align 4
+; CHECK-NEXT: [[INC_I_I:%.*]] = add nsw i32 [[TMP0]], 1
+; CHECK-NEXT: store i32 [[INC_I_I]], ptr [[_REF_I_I]], align 4
+; CHECK-NEXT: ret void
+;
entry:
store ptr %p1, ptr %this, align 8
%_ref.i.i = getelementptr inbounds %class.D, ptr %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
@@ -107,6 +179,11 @@ declare i32 @__gxx_personality_v0(...)
declare void @_ZdlPv()
define ptr @_ZN1BI1DEptEv(ptr nocapture readonly %this) nounwind readonly uwtable align 2 {
+; CHECK-LABEL: @_ZN1BI1DEptEv(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: ret ptr [[TMP0]]
+;
entry:
%0 = load ptr, ptr %this, align 8
ret ptr %0
@@ -115,6 +192,19 @@ entry:
declare void @_ZN1D16deleteKeyPressedEv()
define void @_ZN1BI1DED1Ev(ptr nocapture readonly %this) unnamed_addr uwtable align 2 {
+; CHECK-LABEL: @_ZN1BI1DED1Ev(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: [[_REF_I_I:%.*]] = getelementptr inbounds [[CLASS_D:%.*]], ptr [[TMP0]], i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[_REF_I_I]], align 4
+; CHECK-NEXT: [[TOBOOL_I_I:%.*]] = icmp eq i32 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[TOBOOL_I_I]], label [[_ZN1BI1DED2EV_EXIT:%.*]], label [[DELETE_NOTNULL_I_I:%.*]]
+; CHECK: delete.notnull.i.i:
+; CHECK-NEXT: call void @_ZdlPv()
+; CHECK-NEXT: unreachable
+; CHECK: _ZN1BI1DED2Ev.exit:
+; CHECK-NEXT: ret void
+;
entry:
%0 = load ptr, ptr %this, align 8
%_ref.i.i = getelementptr inbounds %class.D, ptr %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
@@ -136,6 +226,19 @@ _ZN1BI1DED2Ev.exit: ; preds = %entry, %if.then.i.i
declare hidden void @__clang_call_terminate()
define void @_ZN1BI1DED2Ev(ptr nocapture readonly %this) unnamed_addr uwtable align 2 {
+; CHECK-LABEL: @_ZN1BI1DED2Ev(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: [[_REF_I:%.*]] = getelementptr inbounds [[CLASS_D:%.*]], ptr [[TMP0]], i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[_REF_I]], align 4
+; CHECK-NEXT: [[TOBOOL_I:%.*]] = icmp eq i32 [[TMP1]], 0
+; CHECK-NEXT: br i1 [[TOBOOL_I]], label [[_ZN1AI1CE5DEREFEV_EXIT:%.*]], label [[DELETE_NOTNULL_I:%.*]]
+; CHECK: delete.notnull.i:
+; CHECK-NEXT: call void @_ZdlPv()
+; CHECK-NEXT: unreachable
+; CHECK: _ZN1AI1CE5derefEv.exit:
+; CHECK-NEXT: ret void
+;
entry:
%0 = load ptr, ptr %this, align 8
%_ref.i = getelementptr inbounds %class.D, ptr %0, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
@@ -155,6 +258,17 @@ _ZN1AI1CE5derefEv.exit: ; preds = %entry, %if.then.i
}
define void @_ZN1AI1CE5derefEv(ptr nocapture readonly %this) nounwind uwtable align 2 {
+; CHECK-LABEL: @_ZN1AI1CE5derefEv(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[THIS:%.*]], align 4
+; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[TMP0]], 0
+; CHECK-NEXT: br i1 [[TOBOOL]], label [[IF_END:%.*]], label [[DELETE_NOTNULL:%.*]]
+; CHECK: delete.notnull:
+; CHECK-NEXT: call void @_ZdlPv()
+; CHECK-NEXT: unreachable
+; CHECK: if.end:
+; CHECK-NEXT: ret void
+;
entry:
%0 = load i32, ptr %this, align 4
%tobool = icmp eq i32 %0, 0
@@ -172,6 +286,15 @@ if.end: ; preds = %entry, %if.then
}
define void @_ZN1BI1DEC2EPS0_(ptr nocapture %this, ptr %p1) unnamed_addr uwtable align 2 {
+; CHECK-LABEL: @_ZN1BI1DEC2EPS0_(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store ptr [[P1:%.*]], ptr [[THIS:%.*]], align 8
+; CHECK-NEXT: [[_REF_I:%.*]] = getelementptr inbounds [[CLASS_D:%.*]], ptr [[P1]], i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[_REF_I]], align 4
+; CHECK-NEXT: [[INC_I:%.*]] = add nsw i32 [[TMP0]], 1
+; CHECK-NEXT: store i32 [[INC_I]], ptr [[_REF_I]], align 4
+; CHECK-NEXT: ret void
+;
entry:
store ptr %p1, ptr %this, align 8
%_ref.i = getelementptr inbounds %class.D, ptr %p1, i64 0, i32 0, i32 0, i32 1, i32 0, i32 0
@@ -182,6 +305,13 @@ entry:
}
define void @_ZN1AI1CE3refEv(ptr nocapture %this) nounwind uwtable align 2 {
+; CHECK-LABEL: @_ZN1AI1CE3refEv(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[THIS:%.*]], align 4
+; CHECK-NEXT: [[INC:%.*]] = add nsw i32 [[TMP0]], 1
+; CHECK-NEXT: store i32 [[INC]], ptr [[THIS]], align 4
+; CHECK-NEXT: ret void
+;
entry:
%0 = load i32, ptr %this, align 4
%inc = add nsw i32 %0, 1
diff --git a/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll b/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll
index 63d9a667225f..c2ceec36203b 100644
--- a/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll
+++ b/llvm/test/Transforms/JumpThreading/no-irreducible-loops.ll
@@ -1,38 +1,45 @@
-; RUN: opt -S < %s -passes=jump-threading,loop-rotate,instcombine,indvars,loop-unroll,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -verify-dom-info -verify-loop-info > %t
-; RUN: grep "store volatile" %t | count 3
-; RUN: not grep "br label" %t
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading,loop-rotate,instcombine,indvars,loop-unroll,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -verify-dom-info -verify-loop-info < %s | FileCheck %s
; Jump threading should not prevent this loop from being unrolled.
+; There should be 3 volatile stores and no branch
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9.6"
@v1 = external global i32 ; <ptr> [#uses=2]
define i32 @unroll() nounwind {
+; CHECK-LABEL: @unroll(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store volatile i32 1000, ptr @v1, align 4
+; CHECK-NEXT: store volatile i32 1001, ptr @v1, align 4
+; CHECK-NEXT: store volatile i32 1001, ptr @v1, align 4
+; CHECK-NEXT: ret i32 0
+;
entry:
- br label %bb4
+ br label %bb4
bb: ; preds = %bb4
- %0 = icmp eq i32 %i.0, 0 ; <i1> [#uses=1]
- br i1 %0, label %bb1, label %bb2
+ %0 = icmp eq i32 %i.0, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb1, label %bb2
bb1: ; preds = %bb
- store volatile i32 1000, ptr @v1, align 4
- br label %bb3
+ store volatile i32 1000, ptr @v1, align 4
+ br label %bb3
bb2: ; preds = %bb
- store volatile i32 1001, ptr @v1, align 4
- br label %bb3
+ store volatile i32 1001, ptr @v1, align 4
+ br label %bb3
bb3: ; preds = %bb2, %bb1
- %1 = add i32 %i.0, 1 ; <i32> [#uses=1]
- br label %bb4
+ %1 = add i32 %i.0, 1 ; <i32> [#uses=1]
+ br label %bb4
bb4: ; preds = %bb3, %entry
- %i.0 = phi i32 [ 0, %entry ], [ %1, %bb3 ] ; <i32> [#uses=3]
- %2 = icmp sgt i32 %i.0, 2 ; <i1> [#uses=1]
- br i1 %2, label %bb5, label %bb
+ %i.0 = phi i32 [ 0, %entry ], [ %1, %bb3 ] ; <i32> [#uses=3]
+ %2 = icmp sgt i32 %i.0, 2 ; <i1> [#uses=1]
+ br i1 %2, label %bb5, label %bb
bb5: ; preds = %bb4
- ret i32 0
+ ret i32 0
}
diff --git a/llvm/test/Transforms/JumpThreading/pr9331.ll b/llvm/test/Transforms/JumpThreading/pr9331.ll
index aa7a93e6b87e..572b1e558e05 100644
--- a/llvm/test/Transforms/JumpThreading/pr9331.ll
+++ b/llvm/test/Transforms/JumpThreading/pr9331.ll
@@ -1,6 +1,13 @@
-; RUN: opt -passes=jump-threading -S < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=jump-threading < %s | FileCheck %s
define void @func(i8 zeroext %p_44) nounwind {
+; CHECK-LABEL: @func(
+; CHECK-NEXT: return:
+; CHECK-NEXT: ret void
+; CHECK: for.inc46:
+; CHECK-NEXT: br label [[FOR_INC46:%.*]]
+;
entry:
br i1 false, label %for.cond2, label %if.end50
diff --git a/llvm/test/Transforms/JumpThreading/stale-loop-info-after-unfold-select.ll b/llvm/test/Transforms/JumpThreading/stale-loop-info-after-unfold-select.ll
index 333d80803d4b..ba40980c6bf8 100644
--- a/llvm/test/Transforms/JumpThreading/stale-loop-info-after-unfold-select.ll
+++ b/llvm/test/Transforms/JumpThreading/stale-loop-info-after-unfold-select.ll
@@ -1,9 +1,30 @@
-; RUN: opt -passes='require<loops>,jump-threading,verify<loops>' -S < %s
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes='require<loops>,jump-threading,verify<loops>' < %s | FileCheck %s
%"type1" = type { i8 }
%"type2" = type opaque
define dso_local ptr @func2(ptr %this, ptr) {
+; CHECK-LABEL: @func2(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[WHILE_COND:%.*]]
+; CHECK: select.unfold:
+; CHECK-NEXT: br label [[WHILE_COND]]
+; CHECK: while.cond:
+; CHECK-NEXT: [[MONTH_0:%.*]] = phi i32 [ undef, [[ENTRY:%.*]] ], [ [[CALL2:%.*]], [[FUNC1_EXIT:%.*]] ], [ [[ADD:%.*]], [[SELECT_UNFOLD:%.*]] ]
+; CHECK-NEXT: switch i32 [[MONTH_0]], label [[IF_END_I:%.*]] [
+; CHECK-NEXT: i32 4, label [[FUNC1_EXIT]]
+; CHECK-NEXT: i32 1, label [[FUNC1_EXIT]]
+; CHECK-NEXT: ]
+; CHECK: if.end.i:
+; CHECK-NEXT: br label [[FUNC1_EXIT]]
+; CHECK: func1.exit:
+; CHECK-NEXT: [[RETVAL_0_I:%.*]] = phi i32 [ 9, [[IF_END_I]] ], [ 0, [[WHILE_COND]] ], [ 0, [[WHILE_COND]] ]
+; CHECK-NEXT: [[CALL2]] = tail call signext i32 @func3(i32 signext [[RETVAL_0_I]], i32 signext 1, i32 signext 3)
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[CALL2]], 1
+; CHECK-NEXT: [[ADD]] = add nsw i32 [[CALL2]], 2
+; CHECK-NEXT: br i1 [[CMP]], label [[SELECT_UNFOLD]], label [[WHILE_COND]]
+;
entry:
br label %while.cond
More information about the llvm-commits
mailing list