[llvm] 576ab15 - [Test] Few more symmetrical test for D110517
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 6 05:02:47 PDT 2021
Author: Max Kazantsev
Date: 2021-10-06T19:02:28+07:00
New Revision: 576ab15b9092e5a3ef7db656d2472d633cae96a5
URL: https://github.com/llvm/llvm-project/commit/576ab15b9092e5a3ef7db656d2472d633cae96a5
DIFF: https://github.com/llvm/llvm-project/commit/576ab15b9092e5a3ef7db656d2472d633cae96a5.diff
LOG: [Test] Few more symmetrical test for D110517
Added:
Modified:
llvm/test/Transforms/IndVarSimplify/outer_phi.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/IndVarSimplify/outer_phi.ll b/llvm/test/Transforms/IndVarSimplify/outer_phi.ll
index 371cb93ec90d..ebb6c9269e42 100644
--- a/llvm/test/Transforms/IndVarSimplify/outer_phi.ll
+++ b/llvm/test/Transforms/IndVarSimplify/outer_phi.ll
@@ -527,6 +527,7 @@ exit:
}
; Similar to test_05a, but inverted 2nd condition.
+; FIXME: We can remove 2nd check in loop.
define i32 @test_05b(i32 %a, i32* %bp) {
; CHECK-LABEL: @test_05b(
; CHECK-NEXT: entry:
@@ -717,6 +718,263 @@ exit:
ret i32 1
}
+
+; Same as test_05a, but 1st condition inverted.
+; FIXME: We can remove 2nd check in loop.
+define i32 @test_05e(i32 %a, i32* %bp) {
+; CHECK-LABEL: @test_05e(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[B:%.*]] = load i32, i32* [[BP:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: br label [[OUTER:%.*]]
+; CHECK: outer:
+; CHECK-NEXT: [[OUTER_IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT_LCSSA:%.*]], [[OUTER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: br label [[INNER:%.*]]
+; CHECK: inner:
+; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[OUTER_IV]], [[OUTER]] ], [ [[IV_NEXT:%.*]], [[INNER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: [[UNSIGNED_COND:%.*]] = icmp ugt i32 [[B]], [[IV]]
+; CHECK-NEXT: br i1 [[UNSIGNED_COND]], label [[INNER_1:%.*]], label [[SIDE_EXIT:%.*]]
+; CHECK: inner.1:
+; CHECK-NEXT: [[SIGNED_COND:%.*]] = icmp slt i32 [[IV]], [[B]]
+; CHECK-NEXT: br i1 [[SIGNED_COND]], label [[INNER_BACKEDGE]], label [[SIDE_EXIT]]
+; CHECK: inner.backedge:
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1
+; CHECK-NEXT: [[INNER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[INNER_LOOP_COND]], label [[INNER]], label [[OUTER_BACKEDGE]]
+; CHECK: outer.backedge:
+; CHECK-NEXT: [[IV_NEXT_LCSSA]] = phi i32 [ [[IV_NEXT]], [[INNER_BACKEDGE]] ]
+; CHECK-NEXT: [[OUTER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[OUTER_LOOP_COND]], label [[OUTER]], label [[EXIT:%.*]]
+; CHECK: side.exit:
+; CHECK-NEXT: ret i32 0
+; CHECK: exit:
+; CHECK-NEXT: ret i32 1
+;
+entry:
+ %b = load i32, i32* %bp, !range !0
+ br label %outer
+
+outer:
+ %outer.iv = phi i32 [0, %entry], [%iv.next, %outer.backedge]
+ br label %inner
+
+
+inner:
+ %iv = phi i32 [%outer.iv, %outer], [%iv.next, %inner.backedge]
+ %unsigned_cond = icmp ugt i32 %b, %iv
+ br i1 %unsigned_cond, label %inner.1, label %side.exit
+
+inner.1:
+ %signed_cond = icmp slt i32 %iv, %b
+ br i1 %signed_cond, label %inner.backedge, label %side.exit
+
+inner.backedge:
+ %iv.next = add nuw nsw i32 %iv, 1
+ %inner.loop.cond = call i1 @cond()
+ br i1 %inner.loop.cond, label %inner, label %outer.backedge
+
+outer.backedge:
+ %outer.loop.cond = call i1 @cond()
+ br i1 %outer.loop.cond, label %outer, label %exit
+
+side.exit:
+ ret i32 0
+
+exit:
+ ret i32 1
+}
+
+; Same as test_05b, but 1st condition inverted.
+; FIXME: We can remove 2nd check in loop.
+define i32 @test_05f(i32 %a, i32* %bp) {
+; CHECK-LABEL: @test_05f(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[B:%.*]] = load i32, i32* [[BP:%.*]], align 4, !range [[RNG0]]
+; CHECK-NEXT: br label [[OUTER:%.*]]
+; CHECK: outer:
+; CHECK-NEXT: [[OUTER_IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT_LCSSA:%.*]], [[OUTER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: br label [[INNER:%.*]]
+; CHECK: inner:
+; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[OUTER_IV]], [[OUTER]] ], [ [[IV_NEXT:%.*]], [[INNER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: [[UNSIGNED_COND:%.*]] = icmp ugt i32 [[B]], [[IV]]
+; CHECK-NEXT: br i1 [[UNSIGNED_COND]], label [[INNER_1:%.*]], label [[SIDE_EXIT:%.*]]
+; CHECK: inner.1:
+; CHECK-NEXT: [[SIGNED_COND:%.*]] = icmp sgt i32 [[B]], [[IV]]
+; CHECK-NEXT: br i1 [[SIGNED_COND]], label [[INNER_BACKEDGE]], label [[SIDE_EXIT]]
+; CHECK: inner.backedge:
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1
+; CHECK-NEXT: [[INNER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[INNER_LOOP_COND]], label [[INNER]], label [[OUTER_BACKEDGE]]
+; CHECK: outer.backedge:
+; CHECK-NEXT: [[IV_NEXT_LCSSA]] = phi i32 [ [[IV_NEXT]], [[INNER_BACKEDGE]] ]
+; CHECK-NEXT: [[OUTER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[OUTER_LOOP_COND]], label [[OUTER]], label [[EXIT:%.*]]
+; CHECK: side.exit:
+; CHECK-NEXT: ret i32 0
+; CHECK: exit:
+; CHECK-NEXT: ret i32 1
+;
+entry:
+ %b = load i32, i32* %bp, !range !0
+ br label %outer
+
+outer:
+ %outer.iv = phi i32 [0, %entry], [%iv.next, %outer.backedge]
+ br label %inner
+
+
+inner:
+ %iv = phi i32 [%outer.iv, %outer], [%iv.next, %inner.backedge]
+ %unsigned_cond = icmp ugt i32 %b, %iv
+ br i1 %unsigned_cond, label %inner.1, label %side.exit
+
+inner.1:
+ %signed_cond = icmp sgt i32 %b, %iv
+ br i1 %signed_cond, label %inner.backedge, label %side.exit
+
+inner.backedge:
+ %iv.next = add nuw nsw i32 %iv, 1
+ %inner.loop.cond = call i1 @cond()
+ br i1 %inner.loop.cond, label %inner, label %outer.backedge
+
+outer.backedge:
+ %outer.loop.cond = call i1 @cond()
+ br i1 %outer.loop.cond, label %outer, label %exit
+
+side.exit:
+ ret i32 0
+
+exit:
+ ret i32 1
+}
+
+; Same as test_05c, but 1st condition inverted.
+; FIXME: We can remove 2nd check in loop.
+define i32 @test_05g(i32 %a, i32* %bp) {
+; CHECK-LABEL: @test_05g(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[B:%.*]] = load i32, i32* [[BP:%.*]], align 4, !range [[RNG1]]
+; CHECK-NEXT: br label [[OUTER:%.*]]
+; CHECK: outer:
+; CHECK-NEXT: [[OUTER_IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT_LCSSA:%.*]], [[OUTER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: br label [[INNER:%.*]]
+; CHECK: inner:
+; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[OUTER_IV]], [[OUTER]] ], [ [[IV_NEXT:%.*]], [[INNER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: [[SIGNED_COND:%.*]] = icmp sgt i32 [[B]], [[IV]]
+; CHECK-NEXT: br i1 [[SIGNED_COND]], label [[INNER_1:%.*]], label [[SIDE_EXIT:%.*]]
+; CHECK: inner.1:
+; CHECK-NEXT: [[UNSIGNED_COND:%.*]] = icmp ult i32 [[IV]], [[B]]
+; CHECK-NEXT: br i1 [[UNSIGNED_COND]], label [[INNER_BACKEDGE]], label [[SIDE_EXIT]]
+; CHECK: inner.backedge:
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1
+; CHECK-NEXT: [[INNER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[INNER_LOOP_COND]], label [[INNER]], label [[OUTER_BACKEDGE]]
+; CHECK: outer.backedge:
+; CHECK-NEXT: [[IV_NEXT_LCSSA]] = phi i32 [ [[IV_NEXT]], [[INNER_BACKEDGE]] ]
+; CHECK-NEXT: [[OUTER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[OUTER_LOOP_COND]], label [[OUTER]], label [[EXIT:%.*]]
+; CHECK: side.exit:
+; CHECK-NEXT: ret i32 0
+; CHECK: exit:
+; CHECK-NEXT: ret i32 1
+;
+entry:
+ %b = load i32, i32* %bp, !range !1
+ br label %outer
+
+outer:
+ %outer.iv = phi i32 [0, %entry], [%iv.next, %outer.backedge]
+ br label %inner
+
+
+inner:
+ %iv = phi i32 [%outer.iv, %outer], [%iv.next, %inner.backedge]
+ %signed_cond = icmp sgt i32 %b, %iv
+ br i1 %signed_cond, label %inner.1, label %side.exit
+
+inner.1:
+ %unsigned_cond = icmp ult i32 %iv, %b
+ br i1 %unsigned_cond, label %inner.backedge, label %side.exit
+
+inner.backedge:
+ %iv.next = add nuw nsw i32 %iv, 1
+ %inner.loop.cond = call i1 @cond()
+ br i1 %inner.loop.cond, label %inner, label %outer.backedge
+
+outer.backedge:
+ %outer.loop.cond = call i1 @cond()
+ br i1 %outer.loop.cond, label %outer, label %exit
+
+side.exit:
+ ret i32 0
+
+exit:
+ ret i32 1
+}
+
+; Same as test_05d, but 1st condition inverted.
+; FIXME: We can remove 2nd check in loop.
+define i32 @test_05h(i32 %a, i32* %bp) {
+; CHECK-LABEL: @test_05h(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[B:%.*]] = load i32, i32* [[BP:%.*]], align 4, !range [[RNG1]]
+; CHECK-NEXT: br label [[OUTER:%.*]]
+; CHECK: outer:
+; CHECK-NEXT: [[OUTER_IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT_LCSSA:%.*]], [[OUTER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: br label [[INNER:%.*]]
+; CHECK: inner:
+; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[OUTER_IV]], [[OUTER]] ], [ [[IV_NEXT:%.*]], [[INNER_BACKEDGE:%.*]] ]
+; CHECK-NEXT: [[SIGNED_COND:%.*]] = icmp sgt i32 [[B]], [[IV]]
+; CHECK-NEXT: br i1 [[SIGNED_COND]], label [[INNER_1:%.*]], label [[SIDE_EXIT:%.*]]
+; CHECK: inner.1:
+; CHECK-NEXT: [[UNSIGNED_COND:%.*]] = icmp ugt i32 [[B]], [[IV]]
+; CHECK-NEXT: br i1 [[UNSIGNED_COND]], label [[INNER_BACKEDGE]], label [[SIDE_EXIT]]
+; CHECK: inner.backedge:
+; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i32 [[IV]], 1
+; CHECK-NEXT: [[INNER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[INNER_LOOP_COND]], label [[INNER]], label [[OUTER_BACKEDGE]]
+; CHECK: outer.backedge:
+; CHECK-NEXT: [[IV_NEXT_LCSSA]] = phi i32 [ [[IV_NEXT]], [[INNER_BACKEDGE]] ]
+; CHECK-NEXT: [[OUTER_LOOP_COND:%.*]] = call i1 @cond()
+; CHECK-NEXT: br i1 [[OUTER_LOOP_COND]], label [[OUTER]], label [[EXIT:%.*]]
+; CHECK: side.exit:
+; CHECK-NEXT: ret i32 0
+; CHECK: exit:
+; CHECK-NEXT: ret i32 1
+;
+entry:
+ %b = load i32, i32* %bp, !range !1
+ br label %outer
+
+outer:
+ %outer.iv = phi i32 [0, %entry], [%iv.next, %outer.backedge]
+ br label %inner
+
+
+inner:
+ %iv = phi i32 [%outer.iv, %outer], [%iv.next, %inner.backedge]
+ %signed_cond = icmp sgt i32 %b, %iv
+ br i1 %signed_cond, label %inner.1, label %side.exit
+
+inner.1:
+ %unsigned_cond = icmp ugt i32 %b, %iv
+ br i1 %unsigned_cond, label %inner.backedge, label %side.exit
+
+inner.backedge:
+ %iv.next = add nuw nsw i32 %iv, 1
+ %inner.loop.cond = call i1 @cond()
+ br i1 %inner.loop.cond, label %inner, label %outer.backedge
+
+outer.backedge:
+ %outer.loop.cond = call i1 @cond()
+ br i1 %outer.loop.cond, label %outer, label %exit
+
+side.exit:
+ ret i32 0
+
+exit:
+ ret i32 1
+}
+
; Same as test_02, but non-negativity of %b is known without context.
; FIXME: We can remove 2nd check in loop.
define i32 @test_06(i32 %a, i32* %bp) {
More information about the llvm-commits
mailing list