[llvm] r230040 - Bugfix for 229954
Philip Reames
listmail at philipreames.com
Fri Feb 20 10:56:14 PST 2015
Author: reames
Date: Fri Feb 20 12:56:14 2015
New Revision: 230040
URL: http://llvm.org/viewvc/llvm-project?rev=230040&view=rev
Log:
Bugfix for 229954
Before calling Function::getGC to test for enablement, we need to make sure there's actually a GC at all via Function::hasGC. Otherwise, we'd crash on functions without a GC. Thankfully, this only mattered if you manually scheduled the pass, but still, oops. :(
Modified:
llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
llvm/trunk/test/Transforms/RewriteStatepointsForGC/basics.ll
Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=230040&r1=230039&r2=230040&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Fri Feb 20 12:56:14 2015
@@ -1911,8 +1911,11 @@ static bool insertParsePoints(Function &
/// point of this function is as an extension point for custom logic.
static bool shouldRewriteStatepointsIn(Function &F) {
// TODO: This should check the GCStrategy
- const std::string StatepointExampleName("statepoint-example");
- return StatepointExampleName == F.getGC();
+ if (F.hasGC()) {
+ const std::string StatepointExampleName("statepoint-example");
+ return StatepointExampleName == F.getGC();
+ } else
+ return false;
}
bool RewriteStatepointsForGC::runOnFunction(Function &F) {
Modified: llvm/trunk/test/Transforms/RewriteStatepointsForGC/basics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/RewriteStatepointsForGC/basics.ll?rev=230040&r1=230039&r2=230040&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/RewriteStatepointsForGC/basics.ll (original)
+++ llvm/trunk/test/Transforms/RewriteStatepointsForGC/basics.ll Fri Feb 20 12:56:14 2015
@@ -74,4 +74,15 @@ merge:
ret i8 addrspace(1)* %obj
}
+; When run over a function which doesn't opt in, should do nothing!
+define i8 addrspace(1)* @test5(i8 addrspace(1)* %obj) {
+; CHECK-LABEL: @test5
+; CHECK-LABEL: entry:
+; CHECK-NEXT: gc.statepoint
+; CHECK-NOT: %obj.relocated = call coldcc i8 addrspace(1)*
+entry:
+ call i32 (void ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @foo, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
+ ret i8 addrspace(1)* %obj
+}
+
declare i32 @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()*, i32, i32, ...)
More information about the llvm-commits
mailing list