[llvm-commits] [llvm] r122054 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_create.ll
Benjamin Kramer
benny.kra at googlemail.com
Fri Dec 17 02:48:15 PST 2010
Author: d0k
Date: Fri Dec 17 04:48:14 2010
New Revision: 122054
URL: http://llvm.org/viewvc/llvm-project?rev=122054&view=rev
Log:
SimplifyCFG: Ranges can be larger than 64 bits. Fixes Release-selfhost build.
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=122054&r1=122053&r2=122054&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Dec 17 04:48:14 2010
@@ -324,7 +324,7 @@
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;
Modified: llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll?rev=122054&r1=122053&r2=122054&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/switch_create.ll Fri Dec 17 04:48:14 2010
@@ -421,3 +421,23 @@
; 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
+}
More information about the llvm-commits
mailing list