summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2013-01-10 23:32:01 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2013-01-10 23:32:01 +0000
commitc5c730b0e054de89cbd1ad710157c41e8b5c4381 (patch)
tree3e9509c77ca377350e8c5ffbdf5c3296afe2a907 /llvm/test
parentcc7f008b850b301910132f94224dc02e32418f67 (diff)
downloadbcm5719-llvm-c5c730b0e054de89cbd1ad710157c41e8b5c4381.tar.gz
bcm5719-llvm-c5c730b0e054de89cbd1ad710157c41e8b5c4381.zip
PR14904: Segmentation fault running pass 'Recognize loop idioms'
The root cause is mistakenly taking for granted that "dyn_cast<Instruction>(a-Value)" return a non-NULL instruction. llvm-svn: 172145
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/LoopIdiom/X86/popcnt.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopIdiom/X86/popcnt.ll b/llvm/test/Transforms/LoopIdiom/X86/popcnt.ll
index 2f458fb2f19..25df93d3a08 100644
--- a/llvm/test/Transforms/LoopIdiom/X86/popcnt.ll
+++ b/llvm/test/Transforms/LoopIdiom/X86/popcnt.ll
@@ -118,3 +118,23 @@ while.end: ; preds = %while.body, %entry
%c.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
ret i32 %c.0.lcssa
}
+
+define i32 @PopCntCrash3(i64 %a, i32 %x) {
+entry:
+ %tobool3 = icmp eq i64 %a, 0
+ %cmp = icmp eq i32 %x, 0
+ br i1 %tobool3, label %while.end, label %while.body
+
+while.body: ; preds = %entry, %while.body
+ %c.05 = phi i32 [ %inc, %while.body ], [ 0, %entry ]
+ %a.addr.04 = phi i64 [ %and, %while.body ], [ %a, %entry ]
+ %inc = add nsw i32 %c.05, 1
+ %sub = add i64 %a.addr.04, -1
+ %and = and i64 %sub, %a.addr.04
+ %tobool = icmp eq i64 %and, 0
+ br i1 %cmp, label %while.end, label %while.body
+
+while.end: ; preds = %while.body, %entry
+ %c.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
+ ret i32 %c.0.lcssa
+}
OpenPOWER on IntegriCloud