[llvm] ee2fded - [NFC][SimplifyCFG] More tests for Arm
Sam Parker via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 04:15:48 PDT 2020
Author: Sam Parker
Date: 2020-08-25T12:13:48+01:00
New Revision: ee2fdedd842c373c967494d7b9eb1e8b2b9c7d53
URL: https://github.com/llvm/llvm-project/commit/ee2fdedd842c373c967494d7b9eb1e8b2b9c7d53
DIFF: https://github.com/llvm/llvm-project/commit/ee2fdedd842c373c967494d7b9eb1e8b2b9c7d53.diff
LOG: [NFC][SimplifyCFG] More tests for Arm
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll b/llvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
index c37cfe28dc2b..2bcbaff50a97 100644
--- a/llvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
+++ b/llvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
@@ -234,4 +234,132 @@ cond.end:
ret i32 %cond
}
+define i32 @or_xor_predicate(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input, i1 %cmp) {
+; CHECK-LABEL: @or_xor_predicate(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP_NOT:%.*]] = xor i1 [[CMP:%.*]], true
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
+; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP1]]
+; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_END:%.*]], label [[COND_FALSE:%.*]]
+; CHECK: cond.false:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
+; CHECK-NEXT: br label [[COND_END]]
+; CHECK: cond.end:
+; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret i32 [[COND]]
+;
+entry:
+ br i1 %cmp, label %lor.lhs.false, label %cond.end
+
+lor.lhs.false:
+ %add = add nsw i32 %c, %a
+ %cmp1 = icmp slt i32 %add, %b
+ br i1 %cmp1, label %cond.end, label %cond.false
+
+cond.false:
+ %0 = load i32, i32* %input, align 4
+ br label %cond.end
+
+cond.end:
+ %cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
+ ret i32 %cond
+}
+
+define i32 @or_xor_predicate_minsize(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input, i1 %cmp) #0 {
+; CHECK-LABEL: @or_xor_predicate_minsize(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP_NOT:%.*]] = xor i1 [[CMP:%.*]], true
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
+; CHECK-NEXT: [[OR_COND:%.*]] = or i1 [[CMP_NOT]], [[CMP1]]
+; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_END:%.*]], label [[COND_FALSE:%.*]]
+; CHECK: cond.false:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
+; CHECK-NEXT: br label [[COND_END]]
+; CHECK: cond.end:
+; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret i32 [[COND]]
+;
+entry:
+ br i1 %cmp, label %lor.lhs.false, label %cond.end
+
+lor.lhs.false:
+ %add = add nsw i32 %c, %a
+ %cmp1 = icmp slt i32 %add, %b
+ br i1 %cmp1, label %cond.end, label %cond.false
+
+cond.false:
+ %0 = load i32, i32* %input, align 4
+ br label %cond.end
+
+cond.end:
+ %cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
+ ret i32 %cond
+}
+
+define i32 @and_xor(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input, i1 %cmp) {
+; CHECK-LABEL: @and_xor(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP_NOT:%.*]] = xor i1 [[CMP:%.*]], true
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
+; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[CMP_NOT]], [[CMP1]]
+; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_FALSE:%.*]], label [[COND_END:%.*]]
+; CHECK: cond.false:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
+; CHECK-NEXT: br label [[COND_END]]
+; CHECK: cond.end:
+; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret i32 [[COND]]
+;
+entry:
+ br i1 %cmp, label %cond.end, label %lor.lhs.false
+
+lor.lhs.false:
+ %add = add nsw i32 %c, %a
+ %cmp1 = icmp slt i32 %add, %b
+ br i1 %cmp1, label %cond.false, label %cond.end
+
+cond.false:
+ %0 = load i32, i32* %input, align 4
+ br label %cond.end
+
+cond.end:
+ %cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
+ ret i32 %cond
+}
+
+define i32 @and_xor_minsize(i32 %a, i32 %b, i32 %c, i32 %d, i32* %input, i1 %cmp) #0 {
+; CHECK-LABEL: @and_xor_minsize(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP_NOT:%.*]] = xor i1 [[CMP:%.*]], true
+; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[C:%.*]], [[A:%.*]]
+; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[ADD]], [[B:%.*]]
+; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[CMP_NOT]], [[CMP1]]
+; CHECK-NEXT: br i1 [[OR_COND]], label [[COND_FALSE:%.*]], label [[COND_END:%.*]]
+; CHECK: cond.false:
+; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[INPUT:%.*]], align 4
+; CHECK-NEXT: br label [[COND_END]]
+; CHECK: cond.end:
+; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP0]], [[COND_FALSE]] ], [ 0, [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret i32 [[COND]]
+;
+entry:
+ br i1 %cmp, label %cond.end, label %lor.lhs.false
+
+lor.lhs.false:
+ %add = add nsw i32 %c, %a
+ %cmp1 = icmp slt i32 %add, %b
+ br i1 %cmp1, label %cond.false, label %cond.end
+
+cond.false:
+ %0 = load i32, i32* %input, align 4
+ br label %cond.end
+
+cond.end:
+ %cond = phi i32 [ %0, %cond.false ], [ 0, %lor.lhs.false ], [ 0, %entry ]
+ ret i32 %cond
+}
+
attributes #0 = { minsize optsize }
More information about the llvm-commits
mailing list