[PATCH] D63064: [ARM] Enable Unroll UpperBound

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 03:19:20 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL362928: [ARM] Enable Unroll UpperBound (authored by dmgreen, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63064?vs=203754&id=203793#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63064/new/

https://reviews.llvm.org/D63064

Files:
  llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
  llvm/trunk/test/Transforms/LoopUnroll/ARM/upperbound.ll


Index: llvm/trunk/test/Transforms/LoopUnroll/ARM/upperbound.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopUnroll/ARM/upperbound.ll
+++ llvm/trunk/test/Transforms/LoopUnroll/ARM/upperbound.ll
@@ -0,0 +1,38 @@
+; RUN: opt -loop-unroll -S -mtriple arm-none-eabi -mcpu=cortex-m7 %s | FileCheck %s -check-prefix=UNROLL
+
+; This test is meant to check that this loop is unrolled into three iterations.
+
+; UNROLL-LABEL: @test
+; UNROLL: load i32, i32*
+; UNROLL: load i32, i32*
+; UNROLL: load i32, i32*
+; UNROLL-NOT: load i32, i32*
+
+define void @test(i32* %x, i32 %n) {
+entry:
+  %sub = add nsw i32 %n, -1
+  %rem = srem i32 %sub, 4
+  %cmp7 = icmp sgt i32 %rem, 0
+  br i1 %cmp7, label %while.body, label %while.end
+
+while.body:                                       ; preds = %entry, %if.end
+  %x.addr.09 = phi i32* [ %incdec.ptr, %if.end ], [ %x, %entry ]
+  %n.addr.08 = phi i32 [ %dec, %if.end ], [ %rem, %entry ]
+  %0 = load i32, i32* %x.addr.09, align 4
+  %cmp1 = icmp slt i32 %0, 10
+  br i1 %cmp1, label %if.then, label %if.end
+
+if.then:                                          ; preds = %while.body
+  store i32 0, i32* %x.addr.09, align 4
+  br label %if.end
+
+if.end:                                           ; preds = %if.then, %while.body
+  %incdec.ptr = getelementptr inbounds i32, i32* %x.addr.09, i32 1
+  %dec = add nsw i32 %n.addr.08, -1
+  %cmp = icmp sgt i32 %dec, 0
+  br i1 %cmp, label %while.body, label %while.end
+
+while.end:                                        ; preds = %if.end, %entry
+  ret void
+}
+
Index: llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ llvm/trunk/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -683,6 +683,7 @@
 
   UP.Partial = true;
   UP.Runtime = true;
+  UP.UpperBound = true;
   UP.UnrollRemainder = true;
   UP.DefaultUnrollRuntimeCount = 4;
   UP.UnrollAndJam = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63064.203793.patch
Type: text/x-patch
Size: 2034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190610/8cc30b10/attachment.bin>


More information about the llvm-commits mailing list