summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-12-17 10:48:14 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-12-17 10:48:14 +0000
commite5f49c4ff2578e57c2653f19e337b21a858fae7a (patch)
tree87e5b5b1461d12c2389f3d68b534d10adc3d5194
parenta29e1bf8ad2b8e4ea2067ec6fbf26c3c84238601 (diff)
downloadbcm5719-llvm-e5f49c4ff2578e57c2653f19e337b21a858fae7a.tar.gz
bcm5719-llvm-e5f49c4ff2578e57c2653f19e337b21a858fae7a.zip
SimplifyCFG: Ranges can be larger than 64 bits. Fixes Release-selfhost build.
llvm-svn: 122054
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp2
-rw-r--r--llvm/test/Transforms/SimplifyCFG/switch_create.ll20
2 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 9bb61b6041c..1eb8e8eecfb 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -324,7 +324,7 @@ GatherConstantCompares(Value *V, std::vector<ConstantInt*> &Vals, Value *&Extra,
Span = Span.inverse();
// If there are a ton of values, we don't want to make a ginormous switch.
- if (Span.getSetSize().getZExtValue() > 8 || Span.isEmptySet() ||
+ if (Span.getSetSize().ugt(8) || Span.isEmptySet() ||
// We don't handle wrapped sets yet.
Span.isWrappedSet())
return 0;
diff --git a/llvm/test/Transforms/SimplifyCFG/switch_create.ll b/llvm/test/Transforms/SimplifyCFG/switch_create.ll
index 369ebc35272..da7f65a6ca3 100644
--- a/llvm/test/Transforms/SimplifyCFG/switch_create.ll
+++ b/llvm/test/Transforms/SimplifyCFG/switch_create.ll
@@ -421,3 +421,23 @@ if.end: ; preds = %if.then, %lor.lhs.f
; CHECK: ]
}
+; Don't crash on ginormous ranges.
+define void @test15(i128 %x) nounwind {
+ %cmp = icmp ugt i128 %x, 2
+ br i1 %cmp, label %if.end, label %lor.false
+
+lor.false:
+ %cmp2 = icmp ne i128 %x, 100000000000000000000
+ br i1 %cmp2, label %if.end, label %if.then
+
+if.then:
+ call void @foo1() noredzone
+ br label %if.end
+
+if.end:
+ ret void
+
+; CHECK: @test15
+; CHECK-NOT: switch
+; CHECK: ret void
+}
OpenPOWER on IntegriCloud