diff options
author | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2020-01-10 09:30:02 +0000 |
---|---|---|
committer | Sjoerd Meijer <sjoerd.meijer@arm.com> | 2020-01-10 09:35:00 +0000 |
commit | 67bf9a6154d4b82c6c01aad01141bf08c1bbd0f6 (patch) | |
tree | a58b3de84821ee7eb0dc42325cc5b6a8b18cd788 /llvm/test/Transforms/IndVarSimplify | |
parent | 346de9b67228f42eb9b55fa3b426b5dedfdb1d40 (diff) | |
download | bcm5719-llvm-67bf9a6154d4b82c6c01aad01141bf08c1bbd0f6.tar.gz bcm5719-llvm-67bf9a6154d4b82c6c01aad01141bf08c1bbd0f6.zip |
[SVEV] Recognise hardware-loop intrinsic loop.decrement.reg
Teach SCEV about the @loop.decrement.reg intrinsic, which has exactly the same
semantics as a sub expression. This allows us to query hardware-loops, which
contain this @loop.decrement.reg intrinsic, so that we can calculate iteration
counts, exit values, etc. of hardwareloops.
This "int_loop_decrement_reg" intrinsic is defined as "IntrNoDuplicate". Thus,
while hardware-loops and tripcounts now become analysable by SCEV, this
prevents the usual loop transformations from applying transformations on
hardware-loops, which is what we want at this point, for which I have added
test cases for loopunrolling and IndVarSimplify and LFTR.
Differential Revision: https://reviews.llvm.org/D71563
Diffstat (limited to 'llvm/test/Transforms/IndVarSimplify')
-rw-r--r-- | llvm/test/Transforms/IndVarSimplify/lftr.ll | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/lftr.ll b/llvm/test/Transforms/IndVarSimplify/lftr.ll index 098f98d5381..abeeb5b05af 100644 --- a/llvm/test/Transforms/IndVarSimplify/lftr.ll +++ b/llvm/test/Transforms/IndVarSimplify/lftr.ll @@ -153,6 +153,34 @@ loopexit: ret i32 %i } +define i32 @quadratic_sgt_loopdec() { +; CHECK-LABEL: @quadratic_sgt_loopdec( +; CHECK-NEXT: entry: +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: [[I:%.*]] = phi i32 [ 10, [[ENTRY:%.*]] ], [ [[I_NEXT:%.*]], [[LOOP]] ] +; CHECK-NEXT: [[I_NEXT]] = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 [[I]], i32 1) +; CHECK-NEXT: store i32 [[I]], i32* @A +; CHECK-NEXT: [[I2:%.*]] = mul i32 [[I]], [[I]] +; CHECK-NEXT: [[EXITCOND:%.*]] = icmp sgt i32 [[I2]], 0 +; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[LOOPEXIT:%.*]] +; CHECK: loopexit: +; CHECK-NEXT: ret i32 0 + +entry: + br label %loop + +loop: + %i = phi i32 [ 10, %entry ], [ %i.next, %loop ] + %i.next = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %i, i32 1) + store i32 %i, i32* @A + %i2 = mul i32 %i, %i + %c = icmp sgt i32 %i2, 0 + br i1 %c, label %loop, label %loopexit + +loopexit: + ret i32 %i +} @data = common global [240 x i8] zeroinitializer, align 16 @@ -629,4 +657,5 @@ exit: } +declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32) |