[llvm] 24cd66d - [HardwareLoops] Add sibling loop test.
David Green via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 15 09:32:55 PDT 2020
Author: David Green
Date: 2020-07-15T16:36:17+01:00
New Revision: 24cd66d2190a093ed580451496513a65a4c7b8ce
URL: https://github.com/llvm/llvm-project/commit/24cd66d2190a093ed580451496513a65a4c7b8ce
DIFF: https://github.com/llvm/llvm-project/commit/24cd66d2190a093ed580451496513a65a4c7b8ce.diff
LOG: [HardwareLoops] Add sibling loop test.
This missed being part of 9e03547cab69.
Added:
llvm/test/Transforms/HardwareLoops/sibling-loops.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/HardwareLoops/sibling-loops.ll b/llvm/test/Transforms/HardwareLoops/sibling-loops.ll
new file mode 100644
index 000000000000..e415e522da7b
--- /dev/null
+++ b/llvm/test/Transforms/HardwareLoops/sibling-loops.ll
@@ -0,0 +1,94 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -hardware-loops -force-hardware-loops=true -hardware-loop-decrement=1 -hardware-loop-counter-bitwidth=32 -S %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-DEC
+
+define arm_aapcs_vfpcc void @test(i16* noalias nocapture readonly %off, i16* noalias nocapture %data, i16* noalias nocapture %dst, i32 %n) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP252:%.*]] = icmp sgt i32 [[N:%.*]], 0
+; CHECK-NEXT: br i1 [[CMP252]], label [[FOR_COND1_PREHEADER_US:%.*]], label [[FOR_COND_CLEANUP:%.*]]
+; CHECK: for.cond1.preheader.us:
+; CHECK-NEXT: [[I_057_US:%.*]] = phi i32 [ [[INC29_US:%.*]], [[FOR_COND_CLEANUP14_US:%.*]] ], [ 0, [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[MUL_US:%.*]] = mul i32 [[I_057_US]], [[N]]
+; CHECK-NEXT: call void @llvm.set.loop.iterations.i32(i32 [[N]])
+; CHECK-NEXT: br label [[FOR_BODY4_US:%.*]]
+; CHECK: for.body4.us:
+; CHECK-NEXT: [[J_053_US:%.*]] = phi i32 [ 0, [[FOR_COND1_PREHEADER_US]] ], [ [[INC_US:%.*]], [[FOR_BODY4_US]] ]
+; CHECK-NEXT: [[ARRAYIDX_US:%.*]] = getelementptr inbounds i16, i16* [[OFF:%.*]], i32 [[J_053_US]]
+; CHECK-NEXT: [[L2:%.*]] = load i16, i16* [[ARRAYIDX_US]], align 2
+; CHECK-NEXT: [[ARRAYIDX5_US:%.*]] = getelementptr inbounds i16, i16* [[DATA:%.*]], i32 [[J_053_US]]
+; CHECK-NEXT: [[L3:%.*]] = load i16, i16* [[ARRAYIDX5_US]], align 2
+; CHECK-NEXT: [[ADD_US:%.*]] = add i16 [[L3]], [[L2]]
+; CHECK-NEXT: [[ADD8_US:%.*]] = add i32 [[J_053_US]], [[MUL_US]]
+; CHECK-NEXT: [[ARRAYIDX9_US:%.*]] = getelementptr inbounds i16, i16* [[DATA]], i32 [[ADD8_US]]
+; CHECK-NEXT: store i16 [[ADD_US]], i16* [[ARRAYIDX9_US]], align 2
+; CHECK-NEXT: [[INC_US]] = add nuw nsw i32 [[J_053_US]], 1
+; CHECK-NEXT: [[TMP0:%.*]] = call i1 @llvm.loop.decrement.i32(i32 1)
+; CHECK-NEXT: br i1 [[TMP0]], label [[FOR_BODY4_US]], label [[FOR_BODY15_US_PREHEADER:%.*]]
+; CHECK: for.body15.us.preheader:
+; CHECK-NEXT: call void @llvm.set.loop.iterations.i32(i32 [[N]])
+; CHECK-NEXT: br label [[FOR_BODY15_US:%.*]]
+; CHECK: for.body15.us:
+; CHECK-NEXT: [[J10_055_US:%.*]] = phi i32 [ [[INC26_US:%.*]], [[FOR_BODY15_US]] ], [ 0, [[FOR_BODY15_US_PREHEADER]] ]
+; CHECK-NEXT: [[ARRAYIDX16_US:%.*]] = getelementptr inbounds i16, i16* [[OFF]], i32 [[J10_055_US]]
+; CHECK-NEXT: [[L0:%.*]] = load i16, i16* [[ARRAYIDX16_US]], align 2
+; CHECK-NEXT: [[ARRAYIDX18_US:%.*]] = getelementptr inbounds i16, i16* [[DATA]], i32 [[J10_055_US]]
+; CHECK-NEXT: [[L1:%.*]] = load i16, i16* [[ARRAYIDX18_US]], align 2
+; CHECK-NEXT: [[ADD20_US:%.*]] = add i16 [[L1]], [[L0]]
+; CHECK-NEXT: [[ADD23_US:%.*]] = add i32 [[J10_055_US]], [[MUL_US]]
+; CHECK-NEXT: [[ARRAYIDX24_US:%.*]] = getelementptr inbounds i16, i16* [[DST:%.*]], i32 [[ADD23_US]]
+; CHECK-NEXT: store i16 [[ADD20_US]], i16* [[ARRAYIDX24_US]], align 2
+; CHECK-NEXT: [[INC26_US]] = add nuw nsw i32 [[J10_055_US]], 1
+; CHECK-NEXT: [[TMP1:%.*]] = call i1 @llvm.loop.decrement.i32(i32 1)
+; CHECK-NEXT: br i1 [[TMP1]], label [[FOR_BODY15_US]], label [[FOR_COND_CLEANUP14_US]]
+; CHECK: for.cond.cleanup14.us:
+; CHECK-NEXT: [[INC29_US]] = add nuw i32 [[I_057_US]], 1
+; CHECK-NEXT: [[EXITCOND94:%.*]] = icmp eq i32 [[INC29_US]], [[N]]
+; CHECK-NEXT: br i1 [[EXITCOND94]], label [[FOR_COND_CLEANUP]], label [[FOR_COND1_PREHEADER_US]]
+; CHECK: for.cond.cleanup:
+; CHECK-NEXT: ret void
+;
+entry:
+ %cmp252 = icmp sgt i32 %n, 0
+ br i1 %cmp252, label %for.cond1.preheader.us, label %for.cond.cleanup
+
+for.cond1.preheader.us: ; preds = %entry, %for.cond.cleanup14.us
+ %i.057.us = phi i32 [ %inc29.us, %for.cond.cleanup14.us ], [ 0, %entry ]
+ %mul.us = mul i32 %i.057.us, %n
+ br label %for.body4.us
+
+for.body4.us: ; preds = %for.body4.us, %for.cond1.preheader.us
+ %j.053.us = phi i32 [ 0, %for.cond1.preheader.us ], [ %inc.us, %for.body4.us ]
+ %arrayidx.us = getelementptr inbounds i16, i16* %off, i32 %j.053.us
+ %l2 = load i16, i16* %arrayidx.us, align 2
+ %arrayidx5.us = getelementptr inbounds i16, i16* %data, i32 %j.053.us
+ %l3 = load i16, i16* %arrayidx5.us, align 2
+ %add.us = add i16 %l3, %l2
+ %add8.us = add i32 %j.053.us, %mul.us
+ %arrayidx9.us = getelementptr inbounds i16, i16* %data, i32 %add8.us
+ store i16 %add.us, i16* %arrayidx9.us, align 2
+ %inc.us = add nuw nsw i32 %j.053.us, 1
+ %exitcond = icmp eq i32 %inc.us, %n
+ br i1 %exitcond, label %for.body15.us, label %for.body4.us
+
+for.body15.us: ; preds = %for.body4.us, %for.body15.us
+ %j10.055.us = phi i32 [ %inc26.us, %for.body15.us ], [ 0, %for.body4.us ]
+ %arrayidx16.us = getelementptr inbounds i16, i16* %off, i32 %j10.055.us
+ %l0 = load i16, i16* %arrayidx16.us, align 2
+ %arrayidx18.us = getelementptr inbounds i16, i16* %data, i32 %j10.055.us
+ %l1 = load i16, i16* %arrayidx18.us, align 2
+ %add20.us = add i16 %l1, %l0
+ %add23.us = add i32 %j10.055.us, %mul.us
+ %arrayidx24.us = getelementptr inbounds i16, i16* %dst, i32 %add23.us
+ store i16 %add20.us, i16* %arrayidx24.us, align 2
+ %inc26.us = add nuw nsw i32 %j10.055.us, 1
+ %exitcond93 = icmp eq i32 %inc26.us, %n
+ br i1 %exitcond93, label %for.cond.cleanup14.us, label %for.body15.us
+
+for.cond.cleanup14.us: ; preds = %for.body15.us
+ %inc29.us = add nuw i32 %i.057.us, 1
+ %exitcond94 = icmp eq i32 %inc29.us, %n
+ br i1 %exitcond94, label %for.cond.cleanup, label %for.cond1.preheader.us
+
+for.cond.cleanup: ; preds = %for.cond.cleanup14.us, %entry
+ ret void
+}
More information about the llvm-commits
mailing list