[llvm] r265486 - [RS4GC] NFC cleanup of the DeferredReplacement class
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 16:18:54 PDT 2016
Author: sanjoy
Date: Tue Apr 5 18:18:53 2016
New Revision: 265486
URL: http://llvm.org/viewvc/llvm-project?rev=265486&view=rev
Log:
[RS4GC] NFC cleanup of the DeferredReplacement class
Instead of constructors use clearly named factory methods.
Modified:
llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=265486&r1=265485&r2=265486&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Tue Apr 5 18:18:53 2016
@@ -1283,9 +1283,20 @@ class DeferredReplacement {
DeferredReplacement() {}
public:
- explicit DeferredReplacement(Instruction *Old, Instruction *New) :
- Old(Old), New(New) {
- assert(Old != New && "Not allowed!");
+ static DeferredReplacement createRAUW(Instruction *Old, Instruction *New) {
+ assert(Old != New && Old && New &&
+ "Cannot RAUW equal values or to / from null!");
+
+ DeferredReplacement D;
+ D.Old = Old;
+ D.New = New;
+ return D;
+ }
+
+ static DeferredReplacement createDelete(Instruction *ToErase) {
+ DeferredReplacement D;
+ D.Old = ToErase;
+ return D;
}
static DeferredReplacement createDeoptimizeReplacement(Instruction *Old) {
@@ -1488,9 +1499,11 @@ makeStatepointExplicitImpl(const CallSit
// llvm::Instruction. Instead, we defer the replacement and deletion to
// after the live sets have been made explicit in the IR, and we no longer
// have raw pointers to worry about.
- Replacements.emplace_back(CS.getInstruction(), GCResult);
+ Replacements.emplace_back(
+ DeferredReplacement::createRAUW(CS.getInstruction(), GCResult));
} else {
- Replacements.emplace_back(CS.getInstruction(), nullptr);
+ Replacements.emplace_back(
+ DeferredReplacement::createDelete(CS.getInstruction()));
}
}
More information about the llvm-commits
mailing list