<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 9:43 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think this may've broken some things... a few of our internal tests<br>
are failing, and one of the GDB tester's tests is segfaulting (<br>
<a href="http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15423" target="_blank">http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15423</a><br>
) - mind taking a look/reverting? Let me know if you'd like more<br>
specific reproductions, steps, etc.<br></blockquote><div><br></div><div>Reverted in r210807; looking at the failures.</div><div><br></div><div>Eli</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On Wed, Jun 11, 2014 at 4:15 PM, Eli Bendersky <<a href="mailto:eliben@google.com">eliben@google.com</a>> wrote:<br>
> Author: eliben<br>
> Date: Wed Jun 11 18:15:35 2014<br>
> New Revision: 210721<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=210721&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=210721&view=rev</a><br>
> Log:<br>
> Teach LoopUnrollPass to respect loop unrolling hints in metadata.<br>
><br>
> See <a href="http://reviews.llvm.org/D4090" target="_blank">http://reviews.llvm.org/D4090</a> for more details.<br>
><br>
> The Clang change that produces this metadata was committed in r210667<br>
><br>
> Patch by Mark Heffernan.<br>
><br>
><br>
> Added:<br>
> llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas.ll<br>
> Modified:<br>
> llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=210721&r1=210720&r2=210721&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=210721&r1=210720&r2=210721&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Wed Jun 11 18:15:35 2014<br>
> @@ -20,6 +20,7 @@<br>
> #include "llvm/IR/DataLayout.h"<br>
> #include "llvm/IR/Dominators.h"<br>
> #include "llvm/IR/IntrinsicInst.h"<br>
> +#include "llvm/IR/Metadata.h"<br>
> #include "llvm/Support/CommandLine.h"<br>
> #include "llvm/Support/Debug.h"<br>
> #include "llvm/Support/raw_ostream.h"<br>
> @@ -36,7 +37,8 @@ UnrollThreshold("unroll-threshold", cl::<br>
><br>
> static cl::opt<unsigned><br>
> UnrollCount("unroll-count", cl::init(0), cl::Hidden,<br>
> - cl::desc("Use this unroll count for all loops, for testing purposes"));<br>
> + cl::desc("Use this unroll count for all loops including those with "<br>
> + "unroll_count pragma values, for testing purposes"));<br>
><br>
> static cl::opt<bool><br>
> UnrollAllowPartial("unroll-allow-partial", cl::init(false), cl::Hidden,<br>
> @@ -47,6 +49,13 @@ static cl::opt<bool><br>
> UnrollRuntime("unroll-runtime", cl::ZeroOrMore, cl::init(false), cl::Hidden,<br>
> cl::desc("Unroll loops with run-time trip counts"));<br>
><br>
> +// Maximum allowed unroll count for a loop being fully unrolled<br>
> +// because of a pragma unroll(enable) statement (ie, metadata<br>
> +// "llvm.loopunroll.enable" is true). This prevents unexpected<br>
> +// behavior like crashing when using this pragma on high trip count<br>
> +// loops.<br>
> +static const unsigned PragmaFullUnrollCountLimit = 1024;<br>
> +<br>
> namespace {<br>
> class LoopUnroll : public LoopPass {<br>
> public:<br>
> @@ -151,6 +160,63 @@ static unsigned ApproximateLoopSize(cons<br>
> return LoopSize;<br>
> }<br>
><br>
> +// Returns the value associated with the given metadata node name (for<br>
> +// example, "llvm.loopunroll.count"). If no such named metadata node<br>
> +// exists, then nullptr is returned.<br>
> +static const ConstantInt *GetUnrollMetadataValue(const Loop *L,<br>
> + StringRef Name) {<br>
> + MDNode *LoopID = L->getLoopID();<br>
> + if (!LoopID) return nullptr;<br>
> +<br>
> + // First operand should refer to the loop id itself.<br>
> + assert(LoopID->getNumOperands() > 0 && "requires at least one operand");<br>
> + assert(LoopID->getOperand(0) == LoopID && "invalid loop id");<br>
> +<br>
> + for (unsigned i = 1, e = LoopID->getNumOperands(); i < e; ++i) {<br>
> + const MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i));<br>
> + if (!MD) continue;<br>
> +<br>
> + const MDString *S = dyn_cast<MDString>(MD->getOperand(0));<br>
> + if (!S) continue;<br>
> +<br>
> + if (Name.equals(S->getString())) {<br>
> + assert(MD->getNumOperands() == 2 &&<br>
> + "Unroll hint metadata should have two operands.");<br>
> + return cast<ConstantInt>(MD->getOperand(1));<br>
> + }<br>
> + }<br>
> + return nullptr;<br>
> +}<br>
> +<br>
> +// Returns true if the loop has an unroll(enable) pragma.<br>
> +static bool HasUnrollEnablePragma(const Loop *L) {<br>
> + const ConstantInt *EnableValue =<br>
> + GetUnrollMetadataValue(L, "llvm.loopunroll.enable");<br>
> + return (EnableValue && EnableValue->getZExtValue());<br>
> + return false;<br>
> +}<br>
> +<br>
> +// Returns true if the loop has an unroll(disable) pragma.<br>
> +static bool HasUnrollDisablePragma(const Loop *L) {<br>
> + const ConstantInt *EnableValue =<br>
> + GetUnrollMetadataValue(L, "llvm.loopunroll.enable");<br>
> + return (EnableValue && !EnableValue->getZExtValue());<br>
> + return false;<br>
> +}<br>
> +<br>
> +// Check for unroll_count(N) pragma. If found, return true and set<br>
> +// Count to the integer parameter of the pragma.<br>
> +static bool HasUnrollCountPragma(const Loop *L, int &Count) {<br>
> + const ConstantInt *CountValue =<br>
> + GetUnrollMetadataValue(L, "llvm.loopunroll.count");<br>
> + if (CountValue) {<br>
> + Count = CountValue->getZExtValue();<br>
> + assert(Count >= 1 && "Unroll count must be positive.");<br>
> + return true;<br>
> + }<br>
> + return false;<br>
> +}<br>
> +<br>
> bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {<br>
> if (skipOptnoneFunction(L))<br>
> return false;<br>
> @@ -202,12 +268,49 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPa<br>
> TripMultiple = SE->getSmallConstantTripMultiple(L, LatchBlock);<br>
> }<br>
><br>
> - bool Runtime = UserRuntime ? CurrentRuntime : UP.Runtime;<br>
> + // User-specified count (either as a command-line option or<br>
> + // constructor parameter) has highest precedence.<br>
> + unsigned Count = UserCount ? CurrentCount : 0;<br>
> +<br>
> + // If there is no user-specified count, unroll pragmas have the next<br>
> + // highest precendence.<br>
> + if (Count == 0) {<br>
> + if (HasUnrollDisablePragma(L)) {<br>
> + // Loop has unroll(disable) pragma.<br>
> + return false;<br>
> + }<br>
><br>
> - // Use a default unroll-count if the user doesn't specify a value<br>
> - // and the trip count is a run-time value. The default is different<br>
> - // for run-time or compile-time trip count loops.<br>
> - unsigned Count = UserCount ? CurrentCount : UP.Count;<br>
> + int PragmaCount;<br>
> + if (HasUnrollCountPragma(L, PragmaCount)) {<br>
> + if (PragmaCount == 1) {<br>
> + // Nothing to do.<br>
> + return false;<br>
> + }<br>
> + Count = PragmaCount;<br>
> + Threshold = NoThreshold;<br>
> + } else if (HasUnrollEnablePragma(L)) {<br>
> + // Loop has unroll(enable) pragma without a unroll_count pragma,<br>
> + // so unroll loop fully if possible.<br>
> + if (TripCount == 0) {<br>
> + DEBUG(dbgs() << " Loop has unroll(enable) pragma but loop cannot be "<br>
> + "fully unrolled because trip count is unknown.\n");<br>
> + // Continue with standard heuristic unrolling.<br>
> + } else if (TripCount > PragmaFullUnrollCountLimit) {<br>
> + DEBUG(dbgs() << " Loop has unroll(enable) pragma but loop cannot be "<br>
> + "fully unrolled because loop count is greater than "<br>
> + << PragmaFullUnrollCountLimit);<br>
> + // Continue with standard heuristic unrolling.<br>
> + } else {<br>
> + Count = TripCount;<br>
> + Threshold = NoThreshold;<br>
> + }<br>
> + }<br>
> + }<br>
> +<br>
> + if (Count == 0)<br>
> + Count = UP.Count;<br>
> +<br>
> + bool Runtime = UserRuntime ? CurrentRuntime : UP.Runtime;<br>
> if (Runtime && Count == 0 && TripCount == 0)<br>
> Count = UnrollRuntimeCount;<br>
><br>
><br>
> Added: llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas.ll?rev=210721&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas.ll?rev=210721&view=auto</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas.ll (added)<br>
> +++ llvm/trunk/test/Transforms/LoopUnroll/unroll-pragmas.ll Wed Jun 11 18:15:35 2014<br>
> @@ -0,0 +1,285 @@<br>
> +; RUN: opt < %s -loop-unroll -S | FileCheck %s<br>
> +<br>
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
> +target triple = "x86_64-unknown-linux-gnu"<br>
> +<br>
> +; loop4 contains a small loop which should be completely unrolled by<br>
> +; the default unrolling heuristics. It serves as a control for the<br>
> +; unroll(disable) pragma test loop4_with_disable.<br>
> +;<br>
> +; CHECK-LABEL: @loop4(<br>
> +; CHECK-NOT: br i1<br>
> +define void @loop4(i32* nocapture %a) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 4<br>
> + br i1 %exitcond, label %for.end, label %for.body<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +<br>
> +; #pragma clang loop unroll(disable)<br>
> +;<br>
> +; CHECK-LABEL: @loop4_with_disable(<br>
> +; CHECK: store i32<br>
> +; CHECK-NOT: store i32<br>
> +; CHECK: br i1<br>
> +define void @loop4_with_disable(i32* nocapture %a) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 4<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !1<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +!1 = metadata !{metadata !1, metadata !2}<br>
> +!2 = metadata !{metadata !"llvm.loopunroll.enable", i1 false}<br>
> +<br>
> +; loop64 has a high enough count that it should *not* be unrolled by<br>
> +; the default unrolling heuristic. It serves as the control for the<br>
> +; unroll(enable) pragma test loop64_with_.* tests below.<br>
> +;<br>
> +; CHECK-LABEL: @loop64(<br>
> +; CHECK: store i32<br>
> +; CHECK-NOT: store i32<br>
> +; CHECK: br i1<br>
> +define void @loop64(i32* nocapture %a) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 64<br>
> + br i1 %exitcond, label %for.end, label %for.body<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +<br>
> +; #pragma clang loop unroll(enable)<br>
> +; Loop should be fully unrolled.<br>
> +;<br>
> +; CHECK-LABEL: @loop64_with_enable(<br>
> +; CHECK-NOT: br i1<br>
> +define void @loop64_with_enable(i32* nocapture %a) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 64<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !3<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +!3 = metadata !{metadata !3, metadata !4}<br>
> +!4 = metadata !{metadata !"llvm.loopunroll.enable", i1 true}<br>
> +<br>
> +; #pragma clang loop unroll_count(4)<br>
> +; Loop should be unrolled 4 times.<br>
> +;<br>
> +; CHECK-LABEL: @loop64_with_count4(<br>
> +; CHECK: store i32<br>
> +; CHECK: store i32<br>
> +; CHECK: store i32<br>
> +; CHECK: store i32<br>
> +; CHECK-NOT: store i32<br>
> +; CHECK: br i1<br>
> +define void @loop64_with_count4(i32* nocapture %a) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 64<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !5<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +!5 = metadata !{metadata !5, metadata !6}<br>
> +!6 = metadata !{metadata !"llvm.loopunroll.count", i32 4}<br>
> +<br>
> +<br>
> +; #pragma clang loop unroll_count(enable) unroll_count(4)<br>
> +; Loop should be unrolled 4 times.<br>
> +;<br>
> +; CHECK-LABEL: @loop64_with_enable_and_count4(<br>
> +; CHECK: store i32<br>
> +; CHECK: store i32<br>
> +; CHECK: store i32<br>
> +; CHECK: store i32<br>
> +; CHECK-NOT: store i32<br>
> +; CHECK: br i1<br>
> +define void @loop64_with_enable_and_count4(i32* nocapture %a) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 64<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !7<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +!7 = metadata !{metadata !7, metadata !6, metadata !4}<br>
> +<br>
> +; #pragma clang loop unroll_count(enable)<br>
> +; Full unrolling is requested, but loop has a dynamic trip count so<br>
> +; no unrolling should occur.<br>
> +;<br>
> +; CHECK-LABEL: @dynamic_loop_with_enable(<br>
> +; CHECK: store i32<br>
> +; CHECK-NOT: store i32<br>
> +; CHECK: br i1<br>
> +define void @dynamic_loop_with_enable(i32* nocapture %a, i32 %b) {<br>
> +entry:<br>
> + %cmp3 = icmp sgt i32 %b, 0<br>
> + br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !8<br>
> +<br>
> +for.body: ; preds = %entry, %for.body<br>
> + %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %lftr.wideiv = trunc i64 %indvars.iv.next to i32<br>
> + %exitcond = icmp eq i32 %lftr.wideiv, %b<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !8<br>
> +<br>
> +for.end: ; preds = %for.body, %entry<br>
> + ret void<br>
> +}<br>
> +!8 = metadata !{metadata !8, metadata !4}<br>
> +<br>
> +; #pragma clang loop unroll_count(4)<br>
> +; Loop has a dynamic trip count. Unrolling should occur, but no<br>
> +; conditional branches can be removed.<br>
> +;<br>
> +; CHECK-LABEL: @dynamic_loop_with_count4(<br>
> +; CHECK-NOT: store<br>
> +; CHECK: br i1<br>
> +; CHECK: store<br>
> +; CHECK: br i1<br>
> +; CHECK: store<br>
> +; CHECK: br i1<br>
> +; CHECK: store<br>
> +; CHECK: br i1<br>
> +; CHECK: store<br>
> +; CHECK: br i1<br>
> +; CHECK-NOT: br i1<br>
> +define void @dynamic_loop_with_count4(i32* nocapture %a, i32 %b) {<br>
> +entry:<br>
> + %cmp3 = icmp sgt i32 %b, 0<br>
> + br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !9<br>
> +<br>
> +for.body: ; preds = %entry, %for.body<br>
> + %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %lftr.wideiv = trunc i64 %indvars.iv.next to i32<br>
> + %exitcond = icmp eq i32 %lftr.wideiv, %b<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !9<br>
> +<br>
> +for.end: ; preds = %for.body, %entry<br>
> + ret void<br>
> +}<br>
> +!9 = metadata !{metadata !9, metadata !6}<br>
> +<br>
> +; #pragma clang loop unroll_count(1)<br>
> +; Loop should not be unrolled<br>
> +;<br>
> +; CHECK-LABEL: @unroll_1(<br>
> +; CHECK: store i32<br>
> +; CHECK-NOT: store i32<br>
> +; CHECK: br i1<br>
> +define void @unroll_1(i32* nocapture %a, i32 %b) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 4<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !10<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +!10 = metadata !{metadata !10, metadata !11}<br>
> +!11 = metadata !{metadata !"llvm.loopunroll.count", i32 1}<br>
> +<br>
> +; #pragma clang loop unroll(enable)<br>
> +; Loop has very high loop count (1 million) and full unrolling was requested.<br>
> +; Loop should not be unrolled.<br>
> +;<br>
> +; CHECK-LABEL: @unroll_1M(<br>
> +; CHECK: store i32<br>
> +; CHECK-NOT: store i32<br>
> +; CHECK: br i1<br>
> +define void @unroll_1M(i32* nocapture %a, i32 %b) {<br>
> +entry:<br>
> + br label %for.body<br>
> +<br>
> +for.body: ; preds = %for.body, %entry<br>
> + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]<br>
> + %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv<br>
> + %0 = load i32* %arrayidx, align 4<br>
> + %inc = add nsw i32 %0, 1<br>
> + store i32 %inc, i32* %arrayidx, align 4<br>
> + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1<br>
> + %exitcond = icmp eq i64 %indvars.iv.next, 1000000<br>
> + br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !12<br>
> +<br>
> +for.end: ; preds = %for.body<br>
> + ret void<br>
> +}<br>
> +!12 = metadata !{metadata !12, metadata !4}<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div></div>