summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-08 17:12:57 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-08 17:12:57 +0000
commitc46e6a5940c50058e00c0c5f9123fd82e338d29a (patch)
tree89a719d723035c54a190b1f81d329834f1f93336 /test/Transforms
parent148779df305667b6942fee7e758fdf81a6498f38 (diff)
Notes
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/ArgumentPromotion/pr32917.ll23
-rw-r--r--test/Transforms/CodeExtractor/PartialInlineOptRemark.ll54
-rw-r--r--test/Transforms/Inline/inline-hot-callsite.ll12
-rw-r--r--test/Transforms/Inline/prof-update.ll12
-rw-r--r--test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll14
-rw-r--r--test/Transforms/InstCombine/AddOverFlow.ll76
-rw-r--r--test/Transforms/InstCombine/and-or-icmps.ll4
-rw-r--r--test/Transforms/InstCombine/debuginfo-dce.ll52
-rw-r--r--test/Transforms/InstCombine/demand_shrink_nsw.ll2
-rw-r--r--test/Transforms/InstCombine/or.ll11
-rw-r--r--test/Transforms/InstCombine/strlen-1.ll22
-rw-r--r--test/Transforms/InstSimplify/AndOrXor.ll45
-rw-r--r--test/Transforms/InstSimplify/compare.ll29
-rw-r--r--test/Transforms/InstSimplify/icmp-ranges.ll2726
-rw-r--r--test/Transforms/InstSimplify/shufflevector.ll14
-rw-r--r--test/Transforms/LoopIdiom/unsafe.ll55
-rw-r--r--test/Transforms/LoopRotate/dbgvalue.ll47
-rw-r--r--test/Transforms/SampleProfile/Inputs/indirect-call.prof24
-rw-r--r--test/Transforms/SampleProfile/indirect-call.ll58
19 files changed, 3141 insertions, 139 deletions
diff --git a/test/Transforms/ArgumentPromotion/pr32917.ll b/test/Transforms/ArgumentPromotion/pr32917.ll
new file mode 100644
index 0000000000000..a2aeac081cea0
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/pr32917.ll
@@ -0,0 +1,23 @@
+; RUN: opt < %s -argpromotion -S | FileCheck %s
+; PR 32917
+
+@b = common local_unnamed_addr global i32 0, align 4
+@a = common local_unnamed_addr global i32 0, align 4
+
+define i32 @fn2() local_unnamed_addr {
+ %1 = load i32, i32* @b, align 4
+ %2 = sext i32 %1 to i64
+ %3 = inttoptr i64 %2 to i32*
+ call fastcc void @fn1(i32* %3)
+ ret i32 undef
+}
+
+define internal fastcc void @fn1(i32* nocapture readonly) unnamed_addr {
+ %2 = getelementptr inbounds i32, i32* %0, i64 -1
+ %3 = load i32, i32* %2, align 4
+ store i32 %3, i32* @a, align 4
+ ret void
+}
+
+; CHECK: getelementptr {{.*}} -1
+; CHECK-NOT: getelementptr {{.*}} 4294967295
diff --git a/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll b/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll
index b2442b8b173cf..c0d89d606d66e 100644
--- a/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll
+++ b/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll
@@ -32,52 +32,52 @@ bb2: ; preds = %bb1, %bb
ret i32 %tmp3, !dbg !19
}
-define i32 @bar_noinline(i32 %arg) local_unnamed_addr #1 !dbg !5 {
+define i32 @bar_noinline(i32 %arg) local_unnamed_addr #1 !dbg !23 {
bb:
- %tmp = icmp slt i32 %arg, 0, !dbg !7
- br i1 %tmp, label %bb1, label %bb2, !dbg !8
+ %tmp = icmp slt i32 %arg, 0, !dbg !24
+ br i1 %tmp, label %bb1, label %bb2, !dbg !24
bb1: ; preds = %bb
- tail call void (...) @foo() #0, !dbg !9
- tail call void (...) @foo() #0, !dbg !10
- tail call void (...) @foo() #0, !dbg !11
- br label %bb2, !dbg !18
+ tail call void (...) @foo() #0, !dbg !24
+ tail call void (...) @foo() #0, !dbg !24
+ tail call void (...) @foo() #0, !dbg !24
+ br label %bb2, !dbg !24
bb2: ; preds = %bb1, %bb
%tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
- ret i32 %tmp3, !dbg !19
+ ret i32 %tmp3, !dbg !24
}
-define i32 @bar_alwaysinline(i32 %arg) local_unnamed_addr #2 !dbg !5 {
+define i32 @bar_alwaysinline(i32 %arg) local_unnamed_addr #2 !dbg !25 {
bb:
- %tmp = icmp slt i32 %arg, 0, !dbg !7
- br i1 %tmp, label %bb1, label %bb2, !dbg !8
+ %tmp = icmp slt i32 %arg, 0, !dbg !26
+ br i1 %tmp, label %bb1, label %bb2, !dbg !26
bb1: ; preds = %bb
- tail call void (...) @foo() #0, !dbg !9
- tail call void (...) @foo() #0, !dbg !10
- tail call void (...) @foo() #0, !dbg !11
- br label %bb2, !dbg !18
+ tail call void (...) @foo() #0, !dbg !26
+ tail call void (...) @foo() #0, !dbg !26
+ tail call void (...) @foo() #0, !dbg !26
+ br label %bb2, !dbg !26
bb2: ; preds = %bb1, %bb
%tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
- ret i32 %tmp3, !dbg !19
+ ret i32 %tmp3, !dbg !26
}
-define i32 @bar_cold(i32 %arg) local_unnamed_addr #3 !dbg !5 {
+define i32 @bar_cold(i32 %arg) local_unnamed_addr #3 !dbg !27 {
bb:
- %tmp = icmp slt i32 %arg, 0, !dbg !7
- br i1 %tmp, label %bb1, label %bb2, !dbg !8
+ %tmp = icmp slt i32 %arg, 0, !dbg !28
+ br i1 %tmp, label %bb1, label %bb2, !dbg !28
bb1: ; preds = %bb
- tail call void (...) @foo() #0, !dbg !9
- tail call void (...) @foo() #0, !dbg !10
- tail call void (...) @foo() #0, !dbg !11
- br label %bb2, !dbg !18
+ tail call void (...) @foo() #0, !dbg !28
+ tail call void (...) @foo() #0, !dbg !28
+ tail call void (...) @foo() #0, !dbg !28
+ br label %bb2, !dbg !28
bb2: ; preds = %bb1, %bb
%tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
- ret i32 %tmp3, !dbg !19
+ ret i32 %tmp3, !dbg !28
}
; Function Attrs: nounwind
@@ -130,3 +130,9 @@ attributes #3 = { cold nounwind }
!20 = distinct !DISubprogram(name: "dummy_caller", scope: !1, file: !1, line: 19, type: !6, isLocal: false, isDefinition: true, scopeLine: 19, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
!21 = !DILocation(line: 21, column: 11, scope: !20)
!22 = !DILocation(line: 21, column: 4, scope: !20)
+!23 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
+!24 = !DILocation(line: 4, column: 6, scope: !23)
+!25 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
+!26 = !DILocation(line: 4, column: 6, scope: !25)
+!27 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !6, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !2)
+!28 = !DILocation(line: 4, column: 6, scope: !27)
diff --git a/test/Transforms/Inline/inline-hot-callsite.ll b/test/Transforms/Inline/inline-hot-callsite.ll
index ebf4030d3d100..48fa3039741f6 100644
--- a/test/Transforms/Inline/inline-hot-callsite.ll
+++ b/test/Transforms/Inline/inline-hot-callsite.ll
@@ -1,16 +1,21 @@
-; RUN: opt < %s -inline -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
-; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
-
; This tests that a hot callsite gets the (higher) inlinehint-threshold even without
; without inline hints and gets inlined because the cost is less than
; inlinehint-threshold. A cold callee with identical body does not get inlined because
; cost exceeds the inline-threshold
+; RUN: opt < %s -inline -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
+; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
+
+; Run this with the default O2 pipeline to test that profile summary analysis
+; is available during inlining.
+; RUN: opt < %s -passes='default<O2>' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
+
define i32 @callee1(i32 %x) {
%x1 = add i32 %x, 1
%x2 = add i32 %x1, 1
%x3 = add i32 %x2, 1
call void @extern()
+ call void @extern()
ret i32 %x3
}
@@ -20,6 +25,7 @@ define i32 @callee2(i32 %x) {
%x2 = add i32 %x1, 1
%x3 = add i32 %x2, 1
call void @extern()
+ call void @extern()
ret i32 %x3
}
diff --git a/test/Transforms/Inline/prof-update.ll b/test/Transforms/Inline/prof-update.ll
index 38fcc7e459964..3fefa1c56ceab 100644
--- a/test/Transforms/Inline/prof-update.ll
+++ b/test/Transforms/Inline/prof-update.ll
@@ -3,6 +3,7 @@
declare void @ext();
declare void @ext1();
+@func = global void ()* null
; CHECK: define void @callee(i32 %n) !prof ![[ENTRY_COUNT:[0-9]*]]
define void @callee(i32 %n) !prof !1 {
@@ -17,12 +18,16 @@ cond_false:
; ext is cloned and updated.
; CHECK: call void @ext(), !prof ![[COUNT_CALLEE:[0-9]*]]
call void @ext(), !prof !2
+ %f = load void ()*, void ()** @func
+; CHECK: call void %f(), !prof ![[COUNT_IND_CALLEE:[0-9]*]]
+ call void %f(), !prof !4
ret void
}
; CHECK: define void @caller()
define void @caller() {
; CHECK: call void @ext(), !prof ![[COUNT_CALLER:[0-9]*]]
+; CHECK: call void %f.i(), !prof ![[COUNT_IND_CALLER:[0-9]*]]
call void @callee(i32 15), !prof !3
ret void
}
@@ -32,8 +37,11 @@ define void @caller() {
!1 = !{!"function_entry_count", i64 1000}
!2 = !{!"branch_weights", i64 2000}
!3 = !{!"branch_weights", i64 400}
+!4 = !{!"VP", i32 0, i64 140, i64 111, i64 80, i64 222, i64 40, i64 333, i64 20}
attributes #0 = { alwaysinline }
; CHECK: ![[ENTRY_COUNT]] = !{!"function_entry_count", i64 600}
; CHECK: ![[COUNT_CALLEE1]] = !{!"branch_weights", i64 2000}
-; CHECK: ![[COUNT_CALLEE]] = !{!"branch_weights", i32 1200}
-; CHECK: ![[COUNT_CALLER]] = !{!"branch_weights", i32 800}
+; CHECK: ![[COUNT_CALLEE]] = !{!"branch_weights", i64 1200}
+; CHECK: ![[COUNT_IND_CALLEE]] = !{!"VP", i32 0, i64 84, i64 111, i64 48, i64 222, i64 24, i64 333, i64 12}
+; CHECK: ![[COUNT_CALLER]] = !{!"branch_weights", i64 800}
+; CHECK: ![[COUNT_IND_CALLER]] = !{!"VP", i32 0, i64 56, i64 111, i64 32, i64 222, i64 16, i64 333, i64 8}
diff --git a/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll b/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll
deleted file mode 100644
index 9c989b9ecf8a4..0000000000000
--- a/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: opt < %s -instcombine -S | \
-; RUN: grep "ret i1 true"
-; PR586
-
-@g_07918478 = external global i32 ; <i32*> [#uses=1]
-
-define i1 @test() {
- %tmp.0 = load i32, i32* @g_07918478 ; <i32> [#uses=2]
- %tmp.1 = icmp ne i32 %tmp.0, 0 ; <i1> [#uses=1]
- %tmp.4 = icmp ult i32 %tmp.0, 4111 ; <i1> [#uses=1]
- %bothcond = or i1 %tmp.1, %tmp.4 ; <i1> [#uses=1]
- ret i1 %bothcond
-}
-
diff --git a/test/Transforms/InstCombine/AddOverFlow.ll b/test/Transforms/InstCombine/AddOverFlow.ll
index a341cb042ccfe..91fa86e815798 100644
--- a/test/Transforms/InstCombine/AddOverFlow.ll
+++ b/test/Transforms/InstCombine/AddOverFlow.ll
@@ -95,6 +95,44 @@ define i16 @ripple_nsw2(i16 %x, i16 %y) {
ret i16 %c
}
+; CHECK-LABEL: @ripple_nsw3
+; CHECK: add nsw i16 %a, %b
+define i16 @ripple_nsw3(i16 %x, i16 %y) {
+ %a = and i16 %y, 43691
+ %b = and i16 %x, 21843
+ %c = add i16 %a, %b
+ ret i16 %c
+}
+
+; Like the previous test, but flip %a and %b
+; CHECK-LABEL: @ripple_nsw4
+; CHECK: add nsw i16 %b, %a
+define i16 @ripple_nsw4(i16 %x, i16 %y) {
+ %a = and i16 %y, 43691
+ %b = and i16 %x, 21843
+ %c = add i16 %b, %a
+ ret i16 %c
+}
+
+; CHECK-LABEL: @ripple_nsw5
+; CHECK: add nsw i16 %a, %b
+define i16 @ripple_nsw5(i16 %x, i16 %y) {
+ %a = or i16 %y, 43691
+ %b = or i16 %x, 54613
+ %c = add i16 %a, %b
+ ret i16 %c
+}
+
+; Like the previous test, but flip %a and %b
+; CHECK-LABEL: @ripple_nsw6
+; CHECK: add nsw i16 %b, %a
+define i16 @ripple_nsw6(i16 %x, i16 %y) {
+ %a = or i16 %y, 43691
+ %b = or i16 %x, 54613
+ %c = add i16 %b, %a
+ ret i16 %c
+}
+
; CHECK-LABEL: @ripple_no_nsw1
; CHECK: add i32 %a, %x
define i32 @ripple_no_nsw1(i32 %x, i32 %y) {
@@ -116,3 +154,41 @@ define i16 @ripple_no_nsw2(i16 %x, i16 %y) {
%c = add i16 %a, %b
ret i16 %c
}
+
+; CHECK-LABEL: @ripple_no_nsw3
+; CHECK: add i16 %a, %b
+define i16 @ripple_no_nsw3(i16 %x, i16 %y) {
+ %a = and i16 %y, 43691
+ %b = and i16 %x, 21845
+ %c = add i16 %a, %b
+ ret i16 %c
+}
+
+; Like the previous test, but flip %a and %b
+; CHECK-LABEL: @ripple_no_nsw4
+; CHECK: add i16 %b, %a
+define i16 @ripple_no_nsw4(i16 %x, i16 %y) {
+ %a = and i16 %y, 43691
+ %b = and i16 %x, 21845
+ %c = add i16 %b, %a
+ ret i16 %c
+}
+
+; CHECK-LABEL: @ripple_no_nsw5
+; CHECK: add i16 %a, %b
+define i16 @ripple_no_nsw5(i16 %x, i16 %y) {
+ %a = or i16 %y, 43689
+ %b = or i16 %x, 54613
+ %c = add i16 %a, %b
+ ret i16 %c
+}
+
+; Like the previous test, but flip %a and %b
+; CHECK-LABEL: @ripple_no_nsw6
+; CHECK: add i16 %b, %a
+define i16 @ripple_no_nsw6(i16 %x, i16 %y) {
+ %a = or i16 %y, 43689
+ %b = or i16 %x, 54613
+ %c = add i16 %b, %a
+ ret i16 %c
+}
diff --git a/test/Transforms/InstCombine/and-or-icmps.ll b/test/Transforms/InstCombine/and-or-icmps.ll
index 464f390f988fb..165f5d1bffed5 100644
--- a/test/Transforms/InstCombine/and-or-icmps.ll
+++ b/test/Transforms/InstCombine/and-or-icmps.ll
@@ -15,9 +15,7 @@ define i1 @PR1817_1(i32 %X) {
define i1 @PR1817_2(i32 %X) {
; CHECK-LABEL: @PR1817_2(
; CHECK-NEXT: [[A:%.*]] = icmp slt i32 %X, 10
-; CHECK-NEXT: [[B:%.*]] = icmp ult i32 %X, 10
-; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
-; CHECK-NEXT: ret i1 [[C]]
+; CHECK-NEXT: ret i1 [[A]]
;
%A = icmp slt i32 %X, 10
%B = icmp ult i32 %X, 10
diff --git a/test/Transforms/InstCombine/debuginfo-dce.ll b/test/Transforms/InstCombine/debuginfo-dce.ll
index 58e9d7d767e99..086743e80820b 100644
--- a/test/Transforms/InstCombine/debuginfo-dce.ll
+++ b/test/Transforms/InstCombine/debuginfo-dce.ll
@@ -37,60 +37,60 @@ entry:
ret void, !dbg !21
}
-define void @salvage_bitcast(%struct.entry* %queue) local_unnamed_addr #0 !dbg !14 {
+define void @salvage_bitcast(%struct.entry* %queue) local_unnamed_addr #0 !dbg !22 {
entry:
%im_not_dead = alloca i8*
- %0 = bitcast %struct.entry* %queue to i8*, !dbg !19
- %1 = bitcast %struct.entry* %queue to i8*, !dbg !19
- call void @llvm.dbg.value(metadata i8* %1, i64 0, metadata !18, metadata !20), !dbg !19
+ %0 = bitcast %struct.entry* %queue to i8*, !dbg !23
+ %1 = bitcast %struct.entry* %queue to i8*, !dbg !23
+ call void @llvm.dbg.value(metadata i8* %1, i64 0, metadata !24, metadata !20), !dbg !23
; CHECK: define void @salvage_bitcast
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[BITCAST_EXPR:[0-9]+]])
store i8* %1, i8** %im_not_dead, align 8
- ret void, !dbg !21
+ ret void, !dbg !23
}
-define void @salvage_gep0(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !14 {
+define void @salvage_gep0(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !25 {
entry:
%im_not_dead = alloca %struct.entry**
- %0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
- %1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
- call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !18, metadata !20), !dbg !19
+ %0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !26
+ %1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !26
+ call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !27, metadata !20), !dbg !26
; CHECK: define void @salvage_gep0
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[GEP0_EXPR:[0-9]+]])
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
- ret void, !dbg !21
+ ret void, !dbg !26
}
-define void @salvage_gep1(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !14 {
+define void @salvage_gep1(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !28 {
entry:
%im_not_dead = alloca %struct.entry**
- %0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
- %1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
- call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !18, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !19
+ %0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !29
+ %1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !29
+ call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !30, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !29
; CHECK: define void @salvage_gep1
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[GEP1_EXPR:[0-9]+]])
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
- ret void, !dbg !21
+ ret void, !dbg !29
}
-define void @salvage_gep2(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !14 {
+define void @salvage_gep2(%struct.entry* %queue, %struct.entry* %end) local_unnamed_addr #0 !dbg !31 {
entry:
%im_not_dead = alloca %struct.entry**
- %0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
- %1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !19
- call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !18, metadata !DIExpression(DW_OP_stack_value)), !dbg !19
+ %0 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !32
+ %1 = getelementptr inbounds %struct.entry, %struct.entry* %queue, i32 -1, i32 0, !dbg !32
+ call void @llvm.dbg.value(metadata %struct.entry** %1, i64 0, metadata !33, metadata !DIExpression(DW_OP_stack_value)), !dbg !32
; CHECK: define void @salvage_gep2
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, i64 0,
; CHECK-SAME: metadata ![[GEP2_EXPR:[0-9]+]])
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
- ret void, !dbg !21
+ ret void, !dbg !32
}
; CHECK: ![[LOAD_EXPR]] = !DIExpression(DW_OP_deref, DW_OP_plus, 0)
@@ -132,3 +132,15 @@ attributes #1 = { nounwind readnone }
!19 = !DILocation(line: 6, column: 17, scope: !14)
!20 = !DIExpression(DW_OP_plus, 0)
!21 = !DILocation(line: 11, column: 1, scope: !14)
+!22 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
+!23 = !DILocation(line: 6, column: 17, scope: !22)
+!24 = !DILocalVariable(name: "entry", scope: !22, file: !1, line: 6, type: !4)
+!25 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
+!26 = !DILocation(line: 6, column: 17, scope: !25)
+!27 = !DILocalVariable(name: "entry", scope: !25, file: !1, line: 6, type: !4)
+!28 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
+!29 = !DILocation(line: 6, column: 17, scope: !28)
+!30 = !DILocalVariable(name: "entry", scope: !28, file: !1, line: 6, type: !4)
+!31 = distinct !DISubprogram(name: "scan", scope: !1, file: !1, line: 4, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !17)
+!32 = !DILocation(line: 6, column: 17, scope: !31)
+!33 = !DILocalVariable(name: "entry", scope: !31, file: !1, line: 6, type: !4)
diff --git a/test/Transforms/InstCombine/demand_shrink_nsw.ll b/test/Transforms/InstCombine/demand_shrink_nsw.ll
index f491742951670..4f7d00e32aaf1 100644
--- a/test/Transforms/InstCombine/demand_shrink_nsw.ll
+++ b/test/Transforms/InstCombine/demand_shrink_nsw.ll
@@ -3,7 +3,7 @@
; The constant at %v35 should be shrunk, but this must lead to the nsw flag of
; %v43 getting removed so that %v44 is not illegally optimized away.
; CHECK-LABEL: @foo
-; CHECK: %v35 = add nuw i32 %v34, 1362915575
+; CHECK: %v35 = add nuw nsw i32 %v34, 1362915575
; ...
; CHECK: add nuw i32 %v42, 1533579450
; CHECK-NEXT: %v44 = or i32 %v43, -2147483648
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll
index 9ae5eafdfccff..bfafd66ebb415 100644
--- a/test/Transforms/InstCombine/or.ll
+++ b/test/Transforms/InstCombine/or.ll
@@ -661,17 +661,6 @@ define i1 @test47(i8 signext %c) {
ret i1 %or
}
-define i1 @test48(i64 %x, i1 %b) {
-; CHECK-LABEL: @test48(
-; CHECK-NEXT: ret i1 true
-;
- %1 = icmp ult i64 %x, 2305843009213693952
- %2 = icmp ugt i64 %x, 2305843009213693951
- %.b = or i1 %2, %b
- %3 = or i1 %1, %.b
- ret i1 %3
-}
-
define i32 @test49(i1 %C) {
; CHECK-LABEL: @test49(
; CHECK-NEXT: [[V:%.*]] = select i1 [[C:%.*]], i32 1019, i32 123
diff --git a/test/Transforms/InstCombine/strlen-1.ll b/test/Transforms/InstCombine/strlen-1.ll
index f3287c0de35f1..1e0dfb6a3088f 100644
--- a/test/Transforms/InstCombine/strlen-1.ll
+++ b/test/Transforms/InstCombine/strlen-1.ll
@@ -64,13 +64,14 @@ define i1 @test_simplify5() {
ret i1 %eq_hello
}
-define i1 @test_simplify6() {
+define i1 @test_simplify6(i8* %str_p) {
; CHECK-LABEL: @test_simplify6(
-; CHECK-NEXT: ret i1 true
+; CHECK-NEXT: [[STRLENFIRST:%.*]] = load i8, i8* [[STR_P:%.*]], align 1
+; CHECK-NEXT: [[EQ_NULL:%.*]] = icmp eq i8 [[STRLENFIRST]], 0
+; CHECK-NEXT: ret i1 [[EQ_NULL]]
;
- %null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
- %null_l = call i32 @strlen(i8* %null_p)
- %eq_null = icmp eq i32 %null_l, 0
+ %str_l = call i32 @strlen(i8* %str_p)
+ %eq_null = icmp eq i32 %str_l, 0
ret i1 %eq_null
}
@@ -86,13 +87,14 @@ define i1 @test_simplify7() {
ret i1 %ne_hello
}
-define i1 @test_simplify8() {
+define i1 @test_simplify8(i8* %str_p) {
; CHECK-LABEL: @test_simplify8(
-; CHECK-NEXT: ret i1 false
+; CHECK-NEXT: [[STRLENFIRST:%.*]] = load i8, i8* [[STR_P:%.*]], align 1
+; CHECK-NEXT: [[NE_NULL:%.*]] = icmp ne i8 [[STRLENFIRST]], 0
+; CHECK-NEXT: ret i1 [[NE_NULL]]
;
- %null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
- %null_l = call i32 @strlen(i8* %null_p)
- %ne_null = icmp ne i32 %null_l, 0
+ %str_l = call i32 @strlen(i8* %str_p)
+ %ne_null = icmp ne i32 %str_l, 0
ret i1 %ne_null
}
diff --git a/test/Transforms/InstSimplify/AndOrXor.ll b/test/Transforms/InstSimplify/AndOrXor.ll
index f9aaa4fa0c6c6..e059d77f1fa88 100644
--- a/test/Transforms/InstSimplify/AndOrXor.ll
+++ b/test/Transforms/InstSimplify/AndOrXor.ll
@@ -468,6 +468,51 @@ define <2 x i3> @and_of_different_cast_icmps_vec(<2 x i8> %i, <2 x i16> %j) {
ret <2 x i3> %and
}
+define i32 @or_of_zexted_icmps(i32 %i) {
+; CHECK-LABEL: @or_of_zexted_icmps(
+; CHECK-NEXT: ret i32 1
+;
+ %cmp0 = icmp ne i32 %i, 0
+ %conv0 = zext i1 %cmp0 to i32
+ %cmp1 = icmp uge i32 4, %i
+ %conv1 = zext i1 %cmp1 to i32
+ %or = or i32 %conv0, %conv1
+ ret i32 %or
+}
+
+; Try a different cast and weird vector types.
+
+define i3 @or_of_bitcast_icmps_vec(<3 x i65> %i) {
+; CHECK-LABEL: @or_of_bitcast_icmps_vec(
+; CHECK-NEXT: ret i3 bitcast (<3 x i1> <i1 true, i1 true, i1 true> to i3)
+;
+ %cmp0 = icmp sge <3 x i65> %i, zeroinitializer
+ %conv0 = bitcast <3 x i1> %cmp0 to i3
+ %cmp1 = icmp slt <3 x i65> %i, zeroinitializer
+ %conv1 = bitcast <3 x i1> %cmp1 to i3
+ %or = or i3 %conv0, %conv1
+ ret i3 %or
+}
+
+; We can't simplify if the casts are different.
+
+define i16 @or_of_different_cast_icmps(i8 %i) {
+; CHECK-LABEL: @or_of_different_cast_icmps(
+; CHECK-NEXT: [[CMP0:%.*]] = icmp ne i8 %i, 0
+; CHECK-NEXT: [[CONV0:%.*]] = zext i1 [[CMP0]] to i16
+; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %i, 1
+; CHECK-NEXT: [[CONV1:%.*]] = sext i1 [[CMP1]] to i16
+; CHECK-NEXT: [[OR:%.*]] = or i16 [[CONV0]], [[CONV1]]
+; CHECK-NEXT: ret i16 [[OR]]
+;
+ %cmp0 = icmp ne i8 %i, 0
+ %conv0 = zext i1 %cmp0 to i16
+ %cmp1 = icmp ne i8 %i, 1
+ %conv1 = sext i1 %cmp1 to i16
+ %or = or i16 %conv0, %conv1
+ ret i16 %or
+}
+
; (A & ~B) | (A ^ B) -> A ^ B
define i32 @test43(i32 %a, i32 %b) {
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index cd2fa880294ad..883bf31ff77a9 100644
--- a/test/Transforms/InstSimplify/compare.ll
+++ b/test/Transforms/InstSimplify/compare.ll
@@ -576,13 +576,38 @@ define i1 @srem3(i16 %X, i32 %Y) {
ret i1 %E
}
-define i1 @udiv2(i32 %X, i32 %Y, i32 %Z) {
+define i1 @udiv2(i32 %Z) {
; CHECK-LABEL: @udiv2(
+; CHECK-NEXT: ret i1 true
+;
%A = udiv exact i32 10, %Z
%B = udiv exact i32 20, %Z
%C = icmp ult i32 %A, %B
ret i1 %C
-; CHECK: ret i1 true
+}
+
+; Exact sdiv and equality preds can simplify.
+
+define i1 @sdiv_exact_equality(i32 %Z) {
+; CHECK-LABEL: @sdiv_exact_equality(
+; CHECK-NEXT: ret i1 false
+;
+ %A = sdiv exact i32 10, %Z
+ %B = sdiv exact i32 20, %Z
+ %C = icmp eq i32 %A, %B
+ ret i1 %C
+}
+
+; FIXME: But not other preds: PR32949 - https://bugs.llvm.org/show_bug.cgi?id=32949
+
+define i1 @sdiv_exact_not_equality(i32 %Z) {
+; CHECK-LABEL: @sdiv_exact_not_equality(
+; CHECK-NEXT: ret i1 true
+;
+ %A = sdiv exact i32 10, %Z
+ %B = sdiv exact i32 20, %Z
+ %C = icmp ult i32 %A, %B
+ ret i1 %C
}
define i1 @udiv3(i32 %X, i32 %Y) {
diff --git a/test/Transforms/InstSimplify/icmp-ranges.ll b/test/Transforms/InstSimplify/icmp-ranges.ll
index 292be6a8a559b..45194f2df4f14 100644
--- a/test/Transforms/InstSimplify/icmp-ranges.ll
+++ b/test/Transforms/InstSimplify/icmp-ranges.ll
@@ -2729,6 +2729,2732 @@ define i1 @and_ult_ult_swap(i8 %x) {
ret i1 %c
}
+; eq
+; x == 13 || x == 17
+
+define i1 @or_eq_eq(i8 %x) {
+; CHECK-LABEL: @or_eq_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x != 17
+
+define i1 @or_eq_ne(i8 %x) {
+; CHECK-LABEL: @or_eq_ne(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x >=s 17
+
+define i1 @or_eq_sge(i8 %x) {
+; CHECK-LABEL: @or_eq_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x >s 17
+
+define i1 @or_eq_sgt(i8 %x) {
+; CHECK-LABEL: @or_eq_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x <=s 17
+
+define i1 @or_eq_sle(i8 %x) {
+; CHECK-LABEL: @or_eq_sle(
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x <s 17
+
+define i1 @or_eq_slt(i8 %x) {
+; CHECK-LABEL: @or_eq_slt(
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x >=u 17
+
+define i1 @or_eq_uge(i8 %x) {
+; CHECK-LABEL: @or_eq_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x >u 17
+
+define i1 @or_eq_ugt(i8 %x) {
+; CHECK-LABEL: @or_eq_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x <=u 17
+
+define i1 @or_eq_ule(i8 %x) {
+; CHECK-LABEL: @or_eq_ule(
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 13 || x <u 17
+
+define i1 @or_eq_ult(i8 %x) {
+; CHECK-LABEL: @or_eq_ult(
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ne
+; x != 13 || x == 17
+
+define i1 @or_ne_eq(i8 %x) {
+; CHECK-LABEL: @or_ne_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x != 17
+
+define i1 @or_ne_ne(i8 %x) {
+; CHECK-LABEL: @or_ne_ne(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x >=s 17
+
+define i1 @or_ne_sge(i8 %x) {
+; CHECK-LABEL: @or_ne_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x >s 17
+
+define i1 @or_ne_sgt(i8 %x) {
+; CHECK-LABEL: @or_ne_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x <=s 17
+
+define i1 @or_ne_sle(i8 %x) {
+; CHECK-LABEL: @or_ne_sle(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x <s 17
+
+define i1 @or_ne_slt(i8 %x) {
+; CHECK-LABEL: @or_ne_slt(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x >=u 17
+
+define i1 @or_ne_uge(i8 %x) {
+; CHECK-LABEL: @or_ne_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x >u 17
+
+define i1 @or_ne_ugt(i8 %x) {
+; CHECK-LABEL: @or_ne_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x <=u 17
+
+define i1 @or_ne_ule(i8 %x) {
+; CHECK-LABEL: @or_ne_ule(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 13 || x <u 17
+
+define i1 @or_ne_ult(i8 %x) {
+; CHECK-LABEL: @or_ne_ult(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; sge
+; x >=s 13 || x == 17
+
+define i1 @or_sge_eq(i8 %x) {
+; CHECK-LABEL: @or_sge_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x != 17
+
+define i1 @or_sge_ne(i8 %x) {
+; CHECK-LABEL: @or_sge_ne(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x >=s 17
+
+define i1 @or_sge_sge(i8 %x) {
+; CHECK-LABEL: @or_sge_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x >s 17
+
+define i1 @or_sge_sgt(i8 %x) {
+; CHECK-LABEL: @or_sge_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x <=s 17
+
+define i1 @or_sge_sle(i8 %x) {
+; CHECK-LABEL: @or_sge_sle(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x <s 17
+
+define i1 @or_sge_slt(i8 %x) {
+; CHECK-LABEL: @or_sge_slt(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x >=u 17
+
+define i1 @or_sge_uge(i8 %x) {
+; CHECK-LABEL: @or_sge_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x >u 17
+
+define i1 @or_sge_ugt(i8 %x) {
+; CHECK-LABEL: @or_sge_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x <=u 17
+
+define i1 @or_sge_ule(i8 %x) {
+; CHECK-LABEL: @or_sge_ule(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 13 || x <u 17
+
+define i1 @or_sge_ult(i8 %x) {
+; CHECK-LABEL: @or_sge_ult(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; sgt
+; x >s 13 || x == 17
+
+define i1 @or_sgt_eq(i8 %x) {
+; CHECK-LABEL: @or_sgt_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x != 17
+
+define i1 @or_sgt_ne(i8 %x) {
+; CHECK-LABEL: @or_sgt_ne(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x >=s 17
+
+define i1 @or_sgt_sge(i8 %x) {
+; CHECK-LABEL: @or_sgt_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x >s 17
+
+define i1 @or_sgt_sgt(i8 %x) {
+; CHECK-LABEL: @or_sgt_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x <=s 17
+
+define i1 @or_sgt_sle(i8 %x) {
+; CHECK-LABEL: @or_sgt_sle(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x <s 17
+
+define i1 @or_sgt_slt(i8 %x) {
+; CHECK-LABEL: @or_sgt_slt(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x >=u 17
+
+define i1 @or_sgt_uge(i8 %x) {
+; CHECK-LABEL: @or_sgt_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x >u 17
+
+define i1 @or_sgt_ugt(i8 %x) {
+; CHECK-LABEL: @or_sgt_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x <=u 17
+
+define i1 @or_sgt_ule(i8 %x) {
+; CHECK-LABEL: @or_sgt_ule(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 13 || x <u 17
+
+define i1 @or_sgt_ult(i8 %x) {
+; CHECK-LABEL: @or_sgt_ult(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; sle
+; x <=s 13 || x == 17
+
+define i1 @or_sle_eq(i8 %x) {
+; CHECK-LABEL: @or_sle_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x != 17
+
+define i1 @or_sle_ne(i8 %x) {
+; CHECK-LABEL: @or_sle_ne(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x >=s 17
+
+define i1 @or_sle_sge(i8 %x) {
+; CHECK-LABEL: @or_sle_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x >s 17
+
+define i1 @or_sle_sgt(i8 %x) {
+; CHECK-LABEL: @or_sle_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x <=s 17
+
+define i1 @or_sle_sle(i8 %x) {
+; CHECK-LABEL: @or_sle_sle(
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x <s 17
+
+define i1 @or_sle_slt(i8 %x) {
+; CHECK-LABEL: @or_sle_slt(
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x >=u 17
+
+define i1 @or_sle_uge(i8 %x) {
+; CHECK-LABEL: @or_sle_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x >u 17
+
+define i1 @or_sle_ugt(i8 %x) {
+; CHECK-LABEL: @or_sle_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x <=u 17
+
+define i1 @or_sle_ule(i8 %x) {
+; CHECK-LABEL: @or_sle_ule(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 13 || x <u 17
+
+define i1 @or_sle_ult(i8 %x) {
+; CHECK-LABEL: @or_sle_ult(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sle i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; slt
+; x <s 13 || x == 17
+
+define i1 @or_slt_eq(i8 %x) {
+; CHECK-LABEL: @or_slt_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x != 17
+
+define i1 @or_slt_ne(i8 %x) {
+; CHECK-LABEL: @or_slt_ne(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x >=s 17
+
+define i1 @or_slt_sge(i8 %x) {
+; CHECK-LABEL: @or_slt_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x >s 17
+
+define i1 @or_slt_sgt(i8 %x) {
+; CHECK-LABEL: @or_slt_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x <=s 17
+
+define i1 @or_slt_sle(i8 %x) {
+; CHECK-LABEL: @or_slt_sle(
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x <s 17
+
+define i1 @or_slt_slt(i8 %x) {
+; CHECK-LABEL: @or_slt_slt(
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x >=u 17
+
+define i1 @or_slt_uge(i8 %x) {
+; CHECK-LABEL: @or_slt_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x >u 17
+
+define i1 @or_slt_ugt(i8 %x) {
+; CHECK-LABEL: @or_slt_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x <=u 17
+
+define i1 @or_slt_ule(i8 %x) {
+; CHECK-LABEL: @or_slt_ule(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 13 || x <u 17
+
+define i1 @or_slt_ult(i8 %x) {
+; CHECK-LABEL: @or_slt_ult(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp slt i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; uge
+; x >=u 13 || x == 17
+
+define i1 @or_uge_eq(i8 %x) {
+; CHECK-LABEL: @or_uge_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x != 17
+
+define i1 @or_uge_ne(i8 %x) {
+; CHECK-LABEL: @or_uge_ne(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x >=s 17
+
+define i1 @or_uge_sge(i8 %x) {
+; CHECK-LABEL: @or_uge_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x >s 17
+
+define i1 @or_uge_sgt(i8 %x) {
+; CHECK-LABEL: @or_uge_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x <=s 17
+
+define i1 @or_uge_sle(i8 %x) {
+; CHECK-LABEL: @or_uge_sle(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x <s 17
+
+define i1 @or_uge_slt(i8 %x) {
+; CHECK-LABEL: @or_uge_slt(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x >=u 17
+
+define i1 @or_uge_uge(i8 %x) {
+; CHECK-LABEL: @or_uge_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x >u 17
+
+define i1 @or_uge_ugt(i8 %x) {
+; CHECK-LABEL: @or_uge_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x <=u 17
+
+define i1 @or_uge_ule(i8 %x) {
+; CHECK-LABEL: @or_uge_ule(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 13 || x <u 17
+
+define i1 @or_uge_ult(i8 %x) {
+; CHECK-LABEL: @or_uge_ult(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp uge i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ugt
+; x >u 13 || x == 17
+
+define i1 @or_ugt_eq(i8 %x) {
+; CHECK-LABEL: @or_ugt_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x != 17
+
+define i1 @or_ugt_ne(i8 %x) {
+; CHECK-LABEL: @or_ugt_ne(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x >=s 17
+
+define i1 @or_ugt_sge(i8 %x) {
+; CHECK-LABEL: @or_ugt_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x >s 17
+
+define i1 @or_ugt_sgt(i8 %x) {
+; CHECK-LABEL: @or_ugt_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x <=s 17
+
+define i1 @or_ugt_sle(i8 %x) {
+; CHECK-LABEL: @or_ugt_sle(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x <s 17
+
+define i1 @or_ugt_slt(i8 %x) {
+; CHECK-LABEL: @or_ugt_slt(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x >=u 17
+
+define i1 @or_ugt_uge(i8 %x) {
+; CHECK-LABEL: @or_ugt_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x >u 17
+
+define i1 @or_ugt_ugt(i8 %x) {
+; CHECK-LABEL: @or_ugt_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 13
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x <=u 17
+
+define i1 @or_ugt_ule(i8 %x) {
+; CHECK-LABEL: @or_ugt_ule(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 13 || x <u 17
+
+define i1 @or_ugt_ult(i8 %x) {
+; CHECK-LABEL: @or_ugt_ult(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ugt i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ule
+; x <=u 13 || x == 17
+
+define i1 @or_ule_eq(i8 %x) {
+; CHECK-LABEL: @or_ule_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x != 17
+
+define i1 @or_ule_ne(i8 %x) {
+; CHECK-LABEL: @or_ule_ne(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x >=s 17
+
+define i1 @or_ule_sge(i8 %x) {
+; CHECK-LABEL: @or_ule_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x >s 17
+
+define i1 @or_ule_sgt(i8 %x) {
+; CHECK-LABEL: @or_ule_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x <=s 17
+
+define i1 @or_ule_sle(i8 %x) {
+; CHECK-LABEL: @or_ule_sle(
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x <s 17
+
+define i1 @or_ule_slt(i8 %x) {
+; CHECK-LABEL: @or_ule_slt(
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x >=u 17
+
+define i1 @or_ule_uge(i8 %x) {
+; CHECK-LABEL: @or_ule_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x >u 17
+
+define i1 @or_ule_ugt(i8 %x) {
+; CHECK-LABEL: @or_ule_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x <=u 17
+
+define i1 @or_ule_ule(i8 %x) {
+; CHECK-LABEL: @or_ule_ule(
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 13 || x <u 17
+
+define i1 @or_ule_ult(i8 %x) {
+; CHECK-LABEL: @or_ule_ult(
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ule i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ult
+; x <u 13 || x == 17
+
+define i1 @or_ult_eq(i8 %x) {
+; CHECK-LABEL: @or_ult_eq(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x != 17
+
+define i1 @or_ult_ne(i8 %x) {
+; CHECK-LABEL: @or_ult_ne(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x >=s 17
+
+define i1 @or_ult_sge(i8 %x) {
+; CHECK-LABEL: @or_ult_sge(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x >s 17
+
+define i1 @or_ult_sgt(i8 %x) {
+; CHECK-LABEL: @or_ult_sgt(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x <=s 17
+
+define i1 @or_ult_sle(i8 %x) {
+; CHECK-LABEL: @or_ult_sle(
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x <s 17
+
+define i1 @or_ult_slt(i8 %x) {
+; CHECK-LABEL: @or_ult_slt(
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x >=u 17
+
+define i1 @or_ult_uge(i8 %x) {
+; CHECK-LABEL: @or_ult_uge(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x >u 17
+
+define i1 @or_ult_ugt(i8 %x) {
+; CHECK-LABEL: @or_ult_ugt(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 13
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x <=u 17
+
+define i1 @or_ult_ule(i8 %x) {
+; CHECK-LABEL: @or_ult_ule(
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 13 || x <u 17
+
+define i1 @or_ult_ult(i8 %x) {
+; CHECK-LABEL: @or_ult_ult(
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ult i8 %x, 13
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; eq
+; x == 23 || x == 17
+
+define i1 @or_eq_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x != 17
+
+define i1 @or_eq_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_ne_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x >=s 17
+
+define i1 @or_eq_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_sge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x >s 17
+
+define i1 @or_eq_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_sgt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x <=s 17
+
+define i1 @or_eq_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x <s 17
+
+define i1 @or_eq_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x >=u 17
+
+define i1 @or_eq_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_uge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x >u 17
+
+define i1 @or_eq_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_ugt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x <=u 17
+
+define i1 @or_eq_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x == 23 || x <u 17
+
+define i1 @or_eq_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_eq_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp eq i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp eq i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ne
+; x != 23 || x == 17
+
+define i1 @or_ne_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x != 17
+
+define i1 @or_ne_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_ne_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x >=s 17
+
+define i1 @or_ne_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_sge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x >s 17
+
+define i1 @or_ne_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_sgt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x <=s 17
+
+define i1 @or_ne_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x <s 17
+
+define i1 @or_ne_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x >=u 17
+
+define i1 @or_ne_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_uge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x >u 17
+
+define i1 @or_ne_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_ugt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x <=u 17
+
+define i1 @or_ne_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x != 23 || x <u 17
+
+define i1 @or_ne_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_ne_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ne i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ne i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; sge
+; x >=s 23 || x == 17
+
+define i1 @or_sge_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x != 17
+
+define i1 @or_sge_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_ne_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x >=s 17
+
+define i1 @or_sge_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_sge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x >s 17
+
+define i1 @or_sge_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_sgt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x <=s 17
+
+define i1 @or_sge_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x <s 17
+
+define i1 @or_sge_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x >=u 17
+
+define i1 @or_sge_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_uge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x >u 17
+
+define i1 @or_sge_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_ugt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x <=u 17
+
+define i1 @or_sge_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=s 23 || x <u 17
+
+define i1 @or_sge_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_sge_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sge i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; sgt
+; x >s 23 || x == 17
+
+define i1 @or_sgt_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x != 17
+
+define i1 @or_sgt_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_ne_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x >=s 17
+
+define i1 @or_sgt_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_sge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x >s 17
+
+define i1 @or_sgt_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_sgt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x <=s 17
+
+define i1 @or_sgt_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x <s 17
+
+define i1 @or_sgt_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x >=u 17
+
+define i1 @or_sgt_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_uge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x >u 17
+
+define i1 @or_sgt_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_ugt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x <=u 17
+
+define i1 @or_sgt_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >s 23 || x <u 17
+
+define i1 @or_sgt_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_sgt_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sgt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp sgt i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; sle
+; x <=s 23 || x == 17
+
+define i1 @or_sle_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x != 17
+
+define i1 @or_sle_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_ne_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x >=s 17
+
+define i1 @or_sle_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_sge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x >s 17
+
+define i1 @or_sle_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_sgt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x <=s 17
+
+define i1 @or_sle_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x <s 17
+
+define i1 @or_sle_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x >=u 17
+
+define i1 @or_sle_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_uge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x >u 17
+
+define i1 @or_sle_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_ugt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x <=u 17
+
+define i1 @or_sle_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=s 23 || x <u 17
+
+define i1 @or_sle_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_sle_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp sle i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp sle i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; slt
+; x <s 23 || x == 17
+
+define i1 @or_slt_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x != 17
+
+define i1 @or_slt_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_ne_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x >=s 17
+
+define i1 @or_slt_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_sge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x >s 17
+
+define i1 @or_slt_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_sgt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x <=s 17
+
+define i1 @or_slt_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x <s 17
+
+define i1 @or_slt_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x >=u 17
+
+define i1 @or_slt_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_uge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x >u 17
+
+define i1 @or_slt_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_ugt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x <=u 17
+
+define i1 @or_slt_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <s 23 || x <u 17
+
+define i1 @or_slt_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_slt_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp slt i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp slt i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; uge
+; x >=u 23 || x == 17
+
+define i1 @or_uge_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x != 17
+
+define i1 @or_uge_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_ne_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x >=s 17
+
+define i1 @or_uge_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_sge_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x >s 17
+
+define i1 @or_uge_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_sgt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x <=s 17
+
+define i1 @or_uge_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x <s 17
+
+define i1 @or_uge_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x >=u 17
+
+define i1 @or_uge_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_uge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x >u 17
+
+define i1 @or_uge_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_ugt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x <=u 17
+
+define i1 @or_uge_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >=u 23 || x <u 17
+
+define i1 @or_uge_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_uge_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp uge i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp uge i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ugt
+; x >u 23 || x == 17
+
+define i1 @or_ugt_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp eq i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x != 17
+
+define i1 @or_ugt_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_ne_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ne i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x >=s 17
+
+define i1 @or_ugt_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_sge_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x >s 17
+
+define i1 @or_ugt_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_sgt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x <=s 17
+
+define i1 @or_ugt_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x <s 17
+
+define i1 @or_ugt_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x >=u 17
+
+define i1 @or_ugt_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_uge_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp uge i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x >u 17
+
+define i1 @or_ugt_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_ugt_swap(
+; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 %x, 17
+; CHECK-NEXT: ret i1 [[B]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x <=u 17
+
+define i1 @or_ugt_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ule i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x >u 23 || x <u 17
+
+define i1 @or_ugt_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_ugt_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ugt i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp ult i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ugt i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ule
+; x <=u 23 || x == 17
+
+define i1 @or_ule_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x != 17
+
+define i1 @or_ule_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_ne_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x >=s 17
+
+define i1 @or_ule_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_sge_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x >s 17
+
+define i1 @or_ule_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_sgt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x <=s 17
+
+define i1 @or_ule_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x <s 17
+
+define i1 @or_ule_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x >=u 17
+
+define i1 @or_ule_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_uge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x >u 17
+
+define i1 @or_ule_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_ugt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x <=u 17
+
+define i1 @or_ule_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <=u 23 || x <u 17
+
+define i1 @or_ule_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_ule_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ule i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ule i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; ult
+; x <u 23 || x == 17
+
+define i1 @or_ult_eq_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_eq_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp eq i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x != 17
+
+define i1 @or_ult_ne_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_ne_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp ne i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x >=s 17
+
+define i1 @or_ult_sge_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_sge_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sge i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp sge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x >s 17
+
+define i1 @or_ult_sgt_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_sgt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp sgt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x <=s 17
+
+define i1 @or_ult_sle_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_sle_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp sle i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp sle i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x <s 17
+
+define i1 @or_ult_slt_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_slt_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 23
+; CHECK-NEXT: [[B:%.*]] = icmp slt i8 %x, 17
+; CHECK-NEXT: [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp slt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x >=u 17
+
+define i1 @or_ult_uge_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_uge_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp uge i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x >u 17
+
+define i1 @or_ult_ugt_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_ugt_swap(
+; CHECK-NEXT: ret i1 true
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp ugt i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x <=u 17
+
+define i1 @or_ult_ule_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_ule_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp ule i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
+; x <u 23 || x <u 17
+
+define i1 @or_ult_ult_swap(i8 %x) {
+; CHECK-LABEL: @or_ult_ult_swap(
+; CHECK-NEXT: [[A:%.*]] = icmp ult i8 %x, 23
+; CHECK-NEXT: ret i1 [[A]]
+;
+ %a = icmp ult i8 %x, 23
+ %b = icmp ult i8 %x, 17
+ %c = or i1 %a, %b
+ ret i1 %c
+}
+
; Special case - slt is uge
; x <u 31 && x <s 0
diff --git a/test/Transforms/InstSimplify/shufflevector.ll b/test/Transforms/InstSimplify/shufflevector.ll
index 6af0db8e5a442..cc49ae3554c05 100644
--- a/test/Transforms/InstSimplify/shufflevector.ll
+++ b/test/Transforms/InstSimplify/shufflevector.ll
@@ -233,3 +233,17 @@ define <8 x i64> @PR30630(<8 x i64> %x) {
ret <8 x i64> %s7
}
+; This case covers internal canonicalization of shuffles with one constant input vector.
+
+;FIXME: Another issue exposed here, this whole function could be simplified to:
+; ret <2 x float> zeroinitializer
+define <2 x float> @PR32872(<2 x float> %x) {
+; CHECK-LABEL: @PR32872(
+; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <2 x float> [[X:%.*]], <2 x float> zeroinitializer, <4 x i32> <i32 2, i32 2, i32 0, i32 1>
+; CHECK-NEXT: [[TMP4:%.*]] = shufflevector <4 x float> zeroinitializer, <4 x float> [[TMP1]], <2 x i32> <i32 4, i32 5>
+; CHECK-NEXT: ret <2 x float> [[TMP4]]
+;
+ %tmp1 = shufflevector <2 x float> %x, <2 x float> zeroinitializer, <4 x i32> <i32 2, i32 2, i32 0, i32 1>
+ %tmp4 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp1, <2 x i32> <i32 4, i32 5>
+ ret <2 x float> %tmp4
+}
diff --git a/test/Transforms/LoopIdiom/unsafe.ll b/test/Transforms/LoopIdiom/unsafe.ll
new file mode 100644
index 0000000000000..8eff8996adfa3
--- /dev/null
+++ b/test/Transforms/LoopIdiom/unsafe.ll
@@ -0,0 +1,55 @@
+; RUN: opt -S < %s -loop-idiom | FileCheck %s
+; CHECK-NOT: memset
+; check that memset is not generated (for stores) because that will result
+; in udiv hoisted out of the loop by the SCEV Expander
+; TODO: ideally we should be able to generate memset
+; if SCEV expander is taught to generate the dependencies
+; at the right point.
+
+@a = global i32 0, align 4
+@b = global i32 0, align 4
+@c = external local_unnamed_addr global [1 x i8], align 1
+
+define void @e() local_unnamed_addr {
+entry:
+ %d0 = load i32, i32* @a, align 4
+ %d1 = load i32, i32* @b, align 4
+ br label %for.cond1thread-pre-split
+
+for.cond1thread-pre-split: ; preds = %for.body5, %entry
+ %div = udiv i32 %d0, %d1
+ br label %for.body5
+
+for.body5: ; preds = %for.body5, %for.cond1thread-pre-split
+ %indvars.iv = phi i64 [ 0, %for.cond1thread-pre-split ], [ %indvars.iv.next, %for.body5 ]
+ %divx = sext i32 %div to i64
+ %0 = add nsw i64 %divx, %indvars.iv
+ %arrayidx = getelementptr inbounds [1 x i8], [1 x i8]* @c, i64 0, i64 %0
+ store i8 0, i8* %arrayidx, align 1
+ %indvars.iv.next = add nsw i64 %indvars.iv, 1
+ %1 = trunc i64 %indvars.iv.next to i32
+ %tobool4 = icmp eq i32 %1, 0
+ br i1 %tobool4, label %for.cond1thread-pre-split, label %for.body5
+}
+
+; The loop's trip count is depending on an unsafe operation
+; udiv. SCEV expander hoists it out of the loop, so loop-idiom
+; should check that the memset is not generated in this case.
+define void @f(i32 %a, i32 %b, i8* nocapture %x) local_unnamed_addr {
+entry:
+ br label %for.body
+
+for.body: ; preds = %for.body6, %entry
+ %div = udiv i32 %a, %b
+ %conv = zext i32 %div to i64
+ br label %for.body6
+
+for.body6: ; preds = %for.body6, %for.body
+ %i.09 = phi i64 [ %inc, %for.body6 ], [ 0, %for.body ]
+ %arrayidx = getelementptr inbounds i8, i8* %x, i64 %i.09
+ store i8 0, i8* %arrayidx, align 1
+ %inc = add nuw nsw i64 %i.09, 1
+ %cmp3 = icmp slt i64 %inc, %conv
+ br i1 %cmp3, label %for.body6, label %for.body
+}
+
diff --git a/test/Transforms/LoopRotate/dbgvalue.ll b/test/Transforms/LoopRotate/dbgvalue.ll
index 9ff8bda4bc08d..90105047f86ae 100644
--- a/test/Transforms/LoopRotate/dbgvalue.ll
+++ b/test/Transforms/LoopRotate/dbgvalue.ll
@@ -38,7 +38,7 @@ return: ; preds = %if.end
ret i32 %z.tr, !dbg !17
}
-define i32 @tak2(i32 %x, i32 %y, i32 %z) nounwind ssp !dbg !0 {
+define i32 @tak2(i32 %x, i32 %y, i32 %z) nounwind ssp !dbg !21 {
; CHECK-LABEL: define i32 @tak2(
; CHECK: entry
; CHECK: tail call void @llvm.dbg.value(metadata i32 %x.tr
@@ -51,29 +51,29 @@ tailrecurse: ; preds = %if.then, %entry
%x.tr = phi i32 [ %x, %entry ], [ %call, %if.then ]
%y.tr = phi i32 [ %y, %entry ], [ %call9, %if.then ]
%z.tr = phi i32 [ %z, %entry ], [ %call14, %if.then ]
- %cmp = icmp slt i32 %y.tr, %x.tr, !dbg !12
- br i1 %cmp, label %if.then, label %if.end, !dbg !12
+ %cmp = icmp slt i32 %y.tr, %x.tr, !dbg !22
+ br i1 %cmp, label %if.then, label %if.end, !dbg !22
if.then: ; preds = %tailrecurse
- tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !6, metadata !DIExpression()), !dbg !7
- tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !8, metadata !DIExpression()), !dbg !9
- tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !10, metadata !DIExpression()), !dbg !11
- %sub = sub nsw i32 %x.tr, 1, !dbg !14
- %call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !14
- %sub6 = sub nsw i32 %y.tr, 1, !dbg !14
- %call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !14
- %sub11 = sub nsw i32 %z.tr, 1, !dbg !14
- %call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !14
+ tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !36, metadata !DIExpression()), !dbg !37
+ tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !38, metadata !DIExpression()), !dbg !39
+ tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !40, metadata !DIExpression()), !dbg !41
+ %sub = sub nsw i32 %x.tr, 1, !dbg !24
+ %call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !24
+ %sub6 = sub nsw i32 %y.tr, 1, !dbg !24
+ %call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !24
+ %sub11 = sub nsw i32 %z.tr, 1, !dbg !24
+ %call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !24
br label %tailrecurse
if.end: ; preds = %tailrecurse
- tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !6, metadata !DIExpression()), !dbg !7
- tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !8, metadata !DIExpression()), !dbg !9
- tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !10, metadata !DIExpression()), !dbg !11
- br label %return, !dbg !16
+ tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !36, metadata !DIExpression()), !dbg !37
+ tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !38, metadata !DIExpression()), !dbg !39
+ tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !40, metadata !DIExpression()), !dbg !41
+ br label %return, !dbg !26
return: ; preds = %if.end
- ret i32 %z.tr, !dbg !17
+ ret i32 %z.tr, !dbg !27
}
@channelColumns = external global i64
@@ -143,3 +143,16 @@ for.end:
!17 = !DILocation(line: 37, column: 1, scope: !13)
!18 = !DIFile(filename: "/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", directory: "/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame")
!20 = !{i32 1, !"Debug Info Version", i32 3}
+!21 = distinct !DISubprogram(name: "tak", line: 32, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !2, file: !18, scope: !1, type: !3)
+!22 = !DILocation(line: 33, column: 3, scope: !23)
+!23 = distinct !DILexicalBlock(line: 32, column: 30, file: !18, scope: !21)
+!24 = !DILocation(line: 34, column: 5, scope: !25)
+!25 = distinct !DILexicalBlock(line: 33, column: 14, file: !18, scope: !23)
+!26 = !DILocation(line: 36, column: 3, scope: !23)
+!27 = !DILocation(line: 37, column: 1, scope: !23)
+!36 = !DILocalVariable(name: "x", line: 32, arg: 1, scope: !21, file: !1, type: !5)
+!37 = !DILocation(line: 32, column: 13, scope: !21)
+!38 = !DILocalVariable(name: "y", line: 32, arg: 2, scope: !21, file: !1, type: !5)
+!39 = !DILocation(line: 32, column: 20, scope: !21)
+!40 = !DILocalVariable(name: "z", line: 32, arg: 3, scope: !21, file: !1, type: !5)
+!41 = !DILocation(line: 32, column: 27, scope: !21)
diff --git a/test/Transforms/SampleProfile/Inputs/indirect-call.prof b/test/Transforms/SampleProfile/Inputs/indirect-call.prof
index aaf9ec15d02e3..ff7be5df977a6 100644
--- a/test/Transforms/SampleProfile/Inputs/indirect-call.prof
+++ b/test/Transforms/SampleProfile/Inputs/indirect-call.prof
@@ -1,19 +1,19 @@
test:63067:0
- 4: 3345 _Z3barv:1398 _Z3foov:2059
+ 1: 3345 _Z3barv:1398 _Z3foov:2059
test_inline:3000:0
- 5: foo_inline1:3000
- 1: 3000
- 5: foo_inline2:4000
- 1: 4000
+ 1: foo_inline1:3000
+ 11: 3000
+ 1: foo_inline2:4000
+ 19: 4000
test_noinline:3000:0
- 5: foo_noinline:3000
- 1: 3000
+ 1: foo_noinline:3000
+ 20: 3000
test_direct:3000:0
- 5: foo_direct:3000
- 1: 3000
+ 1: foo_direct:3000
+ 21: 3000
test_inline_strip:3000:0
- 5: foo_inline_strip:3000
+ 1: foo_inline_strip:3000
1: 3000
-test_inline_strip_confilict:3000:0
- 5: foo_inline_strip_conflict:3000
+test_inline_strip_conflict:3000:0
+ 1: foo_inline_strip_conflict:3000
1: 3000
diff --git a/test/Transforms/SampleProfile/indirect-call.ll b/test/Transforms/SampleProfile/indirect-call.ll
index 4647dd4212998..4101f6f492e53 100644
--- a/test/Transforms/SampleProfile/indirect-call.ll
+++ b/test/Transforms/SampleProfile/indirect-call.ll
@@ -12,7 +12,7 @@ define void @test(void ()*) !dbg !3 {
; CHECK-LABEL: @test_inline
; If the indirect call is promoted and inlined in profile, we should promote and inline it.
-define void @test_inline(i64* (i32*)*, i32* %x) !dbg !3 {
+define void @test_inline(i64* (i32*)*, i32* %x) !dbg !6 {
%2 = alloca i64* (i32*)*
store i64* (i32*)* %0, i64* (i32*)** %2
%3 = load i64* (i32*)*, i64* (i32*)** %2
@@ -25,14 +25,14 @@ define void @test_inline(i64* (i32*)*, i32* %x) !dbg !3 {
; CHECK-NOT: call
; CHECK: if.false.orig_indirect2:
; CHECK: call
- call i64* %3(i32* %x), !dbg !5
+ call i64* %3(i32* %x), !dbg !7
ret void
}
; CHECK-LABEL: @test_inline_strip
; If the indirect call is promoted and inlined in profile, and the callee name
; is stripped we should promote and inline it.
-define void @test_inline_strip(i64* (i32*)*, i32* %x) !dbg !3 {
+define void @test_inline_strip(i64* (i32*)*, i32* %x) !dbg !8 {
%2 = alloca i64* (i32*)*
store i64* (i32*)* %0, i64* (i32*)** %2
%3 = load i64* (i32*)*, i64* (i32*)** %2
@@ -41,74 +41,74 @@ define void @test_inline_strip(i64* (i32*)*, i32* %x) !dbg !3 {
; CHECK-NOT: call
; CHECK: if.false.orig_indirect:
; CHECK: call
- call i64* %3(i32* %x), !dbg !5
+ call i64* %3(i32* %x), !dbg !9
ret void
}
; CHECK-LABEL: @test_inline_strip_conflict
; If the indirect call is promoted and inlined in profile, and the callee name
; is stripped, but have more than 1 potential match, we should not promote.
-define void @test_inline_strip_conflict(i64* (i32*)*, i32* %x) !dbg !3 {
+define void @test_inline_strip_conflict(i64* (i32*)*, i32* %x) !dbg !10 {
%2 = alloca i64* (i32*)*
store i64* (i32*)* %0, i64* (i32*)** %2
%3 = load i64* (i32*)*, i64* (i32*)** %2
; CHECK-NOT: if.true.direct_targ:
- call i64* %3(i32* %x), !dbg !5
+ call i64* %3(i32* %x), !dbg !11
ret void
}
; CHECK-LABEL: @test_noinline
; If the indirect call target is not available, we should not promote it.
-define void @test_noinline(void ()*) !dbg !3 {
+define void @test_noinline(void ()*) !dbg !12 {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = load void ()*, void ()** %2
; CHECK-NOT: icmp
; CHECK: call
- call void %3(), !dbg !5
+ call void %3(), !dbg !13
ret void
}
@x = global i32 0, align 4
-define i32* @foo_inline1(i32* %x) !dbg !3 {
+define i32* @foo_inline1(i32* %x) !dbg !14 {
ret i32* %x
}
-define i32* @foo_inline_strip.suffix(i32* %x) !dbg !3 {
+define i32* @foo_inline_strip.suffix(i32* %x) !dbg !15 {
ret i32* %x
}
-define i32* @foo_inline_strip_conflict.suffix1(i32* %x) !dbg !3 {
+define i32* @foo_inline_strip_conflict.suffix1(i32* %x) !dbg !16 {
ret i32* %x
}
-define i32* @foo_inline_strip_conflict.suffix2(i32* %x) !dbg !3 {
+define i32* @foo_inline_strip_conflict.suffix2(i32* %x) !dbg !17 {
ret i32* %x
}
-define i32* @foo_inline_strip_conflict.suffix3(i32* %x) !dbg !3 {
+define i32* @foo_inline_strip_conflict.suffix3(i32* %x) !dbg !18 {
ret i32* %x
}
-define i32* @foo_inline2(i32* %x) !dbg !3 {
+define i32* @foo_inline2(i32* %x) !dbg !19 {
ret i32* %x
}
-define i32 @foo_noinline(i32 %x) !dbg !3 {
+define i32 @foo_noinline(i32 %x) !dbg !20 {
ret i32 %x
}
-define void @foo_direct() !dbg !3 {
+define void @foo_direct() !dbg !21 {
ret void
}
; CHECK-LABEL: @test_direct
; We should not promote a direct call.
-define void @test_direct() !dbg !3 {
+define void @test_direct() !dbg !22 {
; CHECK-NOT: icmp
; CHECK: call
- call void @foo_alias(), !dbg !5
+ call void @foo_alias(), !dbg !23
ret void
}
@@ -120,7 +120,25 @@ define void @test_direct() !dbg !3 {
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
!1 = !DIFile(filename: "test.cc", directory: "/")
!2 = !{i32 2, !"Debug Info Version", i32 3}
-!3 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, unit: !0)
-!4 = !DILocation(line: 5, scope: !3)
+!3 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, unit: !0)
+!4 = !DILocation(line: 4, scope: !3)
!5 = !DILocation(line: 6, scope: !3)
; CHECK: ![[PROF]] = !{!"VP", i32 0, i64 3457, i64 9191153033785521275, i64 2059, i64 -1069303473483922844, i64 1398}
+!6 = distinct !DISubprogram(name: "test_inline", scope: !1, file: !1, line: 6, unit: !0)
+!7 = !DILocation(line: 7, scope: !6)
+!8 = distinct !DISubprogram(name: "test_inline_strip", scope: !1, file: !1, line: 8, unit: !0)
+!9 = !DILocation(line: 9, scope: !8)
+!10 = distinct !DISubprogram(name: "test_inline_strip_conflict", scope: !1, file: !1, line: 10, unit: !0)
+!11 = !DILocation(line: 11, scope: !10)
+!12 = distinct !DISubprogram(name: "test_noinline", scope: !1, file: !1, line: 12, unit: !0)
+!13 = !DILocation(line: 13, scope: !12)
+!14 = distinct !DISubprogram(name: "foo_inline1", scope: !1, file: !1, line: 11, unit: !0)
+!15 = distinct !DISubprogram(name: "foo_inline_strip.suffix", scope: !1, file: !1, line: 1, unit: !0)
+!16 = distinct !DISubprogram(name: "foo_inline_strip_conflict.suffix1", scope: !1, file: !1, line: 1, unit: !0)
+!17 = distinct !DISubprogram(name: "foo_inline_strip_conflict.suffix2", scope: !1, file: !1, line: 1, unit: !0)
+!18 = distinct !DISubprogram(name: "foo_inline_strip_conflict.suffix3", scope: !1, file: !1, line: 1, unit: !0)
+!19 = distinct !DISubprogram(name: "foo_inline2", scope: !1, file: !1, line: 19, unit: !0)
+!20 = distinct !DISubprogram(name: "foo_noinline", scope: !1, file: !1, line: 20, unit: !0)
+!21 = distinct !DISubprogram(name: "foo_direct", scope: !1, file: !1, line: 21, unit: !0)
+!22 = distinct !DISubprogram(name: "test_direct", scope: !1, file: !1, line: 22, unit: !0)
+!23 = !DILocation(line: 23, scope: !22)