[PATCH] Refactor normalization for invokes in placestatepoints pass.
Philip Reames
listmail at philipreames.com
Tue May 5 15:38:22 PDT 2015
REPOSITORY
rL LLVM
================
Comment at: lib/Transforms/Scalar/PlaceSafepoints.cpp:698
@@ -697,3 @@
- nullptr);
- assert(
- !isa<PHINode>(cast<Instruction>(GCResult)->getParent()->begin()));
----------------
Leaving the assertion here would be good.
================
Comment at: lib/Transforms/Scalar/PlaceSafepoints.cpp:939
@@ +938,3 @@
+ if (isa<PHINode>(toReplace->getNormalDest()->begin())) {
+ normalizeForInvokeSafepoint(toReplace->getNormalDest(),
+ toReplace->getParent());
----------------
Please just do this as a preprocessing step. If the statepoint we're about to insert is for an invoke, normalize it before starting the insertion process. Having this functionality inside a function called ReplaceWithStatepoint seems misleading.
In RewriteStatepointsForGC, we have:
// When inserting gc.relocates for invokes, we need to be able to insert at
// the top of the successor blocks. See the comment on
// normalForInvokeSafepoint on exactly what is needed. Note that this step
// may restructure the CFG.
for (CallSite CS : toUpdate) {
if (!CS.isInvoke())
continue;
InvokeInst *invoke = cast<InvokeInst>(CS.getInstruction());
normalizeForInvokeSafepoint(invoke->getNormalDest(), invoke->getParent(),
P);
normalizeForInvokeSafepoint(invoke->getUnwindDest(), invoke->getParent(),
P);
}
Doing that same thing before calling ReplaceWithStatepoint would seem reasonable.
http://reviews.llvm.org/D9497
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list