diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2017-07-28 06:42:15 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2017-07-28 06:42:15 +0000 |
| commit | fa4969539ad13bfd2c67caa3b206754cef373ba6 (patch) | |
| tree | 57735d3e5470018dd0427ceb986ae06293f985a8 /llvm/test/Transforms/LoopSimplify | |
| parent | 30caae6d23d92a72126cdb2223bd5d2155fd8544 (diff) | |
| download | bcm5719-llvm-fa4969539ad13bfd2c67caa3b206754cef373ba6.tar.gz bcm5719-llvm-fa4969539ad13bfd2c67caa3b206754cef373ba6.zip | |
[SCEV] Do not visit nodes twice in containsConstantSomewhere
This patch reworks the function that searches constants in Add and Mul SCEV expression
chains so that now it does not visit a node more than once, and also renames this function
for better correspondence between its implementation and semantics.
Differential Revision: https://reviews.llvm.org/D35931
llvm-svn: 309367
Diffstat (limited to 'llvm/test/Transforms/LoopSimplify')
| -rw-r--r-- | llvm/test/Transforms/LoopSimplify/pr33494.ll | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopSimplify/pr33494.ll b/llvm/test/Transforms/LoopSimplify/pr33494.ll new file mode 100644 index 00000000000..5d3b4e80941 --- /dev/null +++ b/llvm/test/Transforms/LoopSimplify/pr33494.ll @@ -0,0 +1,75 @@ +; RUN: opt -loop-unroll -loop-simplify -S < %s | FileCheck %s + +; This test is one of the tests of PR33494. Its compilation takes +; excessive time if we don't mark visited nodes while looking for +; constants in SCEV expression trees. + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @test_01(i32* nocapture %a) local_unnamed_addr { + +; CHECK-LABEL: @test_01( + +entry: + %arrayidx = getelementptr inbounds i32, i32* %a, i64 96 + %arrayidx.promoted51 = load i32, i32* %arrayidx, align 1 + br label %while.body + +while.body: ; preds = %entry, %while.end29 + %0 = phi i32 [ %arrayidx.promoted51, %entry ], [ %7, %while.end29 ] + %cmp46 = icmp eq i32 %0, 1 + %conv47 = zext i1 %cmp46 to i32 + %1 = add i32 %0, 1 + %2 = icmp ult i32 %1, 3 + %div48 = select i1 %2, i32 %0, i32 0 + %cmp349 = icmp sgt i32 %div48, %conv47 + br i1 %cmp349, label %while.body4.lr.ph, label %while.end29 + +while.body4.lr.ph: ; preds = %while.body + br label %while.body4 + +while.body4: ; preds = %while.body4.lr.ph, %while.end28 + %3 = phi i32 [ %0, %while.body4.lr.ph ], [ %mul17.lcssa, %while.end28 ] + br label %while.body13 + +while.body13: ; preds = %while.body4, %while.end.split + %mul1745 = phi i32 [ %3, %while.body4 ], [ %mul17, %while.end.split ] + %4 = phi i32 [ 15872, %while.body4 ], [ %add, %while.end.split ] + %mul = mul nsw i32 %mul1745, %mul1745 + %mul17 = mul nsw i32 %mul, %mul1745 + %cmp22 = icmp eq i32 %4, %mul17 + br i1 %cmp22, label %while.body13.split, label %while.end.split + +while.body13.split: ; preds = %while.body13 + br label %while.cond19 + +while.cond19: ; preds = %while.cond19, %while.body13.split + br label %while.cond19 + +while.end.split: ; preds = %while.body13 + %add = shl nsw i32 %4, 1 + %tobool12 = icmp eq i32 %add, 0 + br i1 %tobool12, label %while.end28, label %while.body13 + +while.end28: ; preds = %while.end.split + %add.lcssa = phi i32 [ %add, %while.end.split ] + %mul17.lcssa = phi i32 [ %mul17, %while.end.split ] + %cmp = icmp eq i32 %mul17.lcssa, 1 + %conv = zext i1 %cmp to i32 + %5 = add i32 %mul17.lcssa, 1 + %6 = icmp ult i32 %5, 3 + %div = select i1 %6, i32 %mul17.lcssa, i32 0 + %cmp3 = icmp sgt i32 %div, %conv + br i1 %cmp3, label %while.body4, label %while.cond1.while.end29_crit_edge + +while.cond1.while.end29_crit_edge: ; preds = %while.end28 + %.lcssa = phi i32 [ %mul17.lcssa, %while.end28 ] + %add.lcssa50.lcssa = phi i32 [ %add.lcssa, %while.end28 ] + store i32 %add.lcssa50.lcssa, i32* %a, align 4 + br label %while.end29 + +while.end29: ; preds = %while.cond1.while.end29_crit_edge, %while.body + %7 = phi i32 [ %.lcssa, %while.cond1.while.end29_crit_edge ], [ %0, %while.body ] + br label %while.body +} |

