aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-03-23 02:24:07 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-03-23 02:24:07 +0000
commite58ca59cf4d94c91c60e067b207b9ee8d3dcd8af (patch)
treeb86af75efda4ac607388b55ab68648574dc0a07e /llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
parent52ecd2d69b7a6c5c3de0167e00774e26ab7390a2 (diff)
downloadllvm-e58ca59cf4d94c91c60e067b207b9ee8d3dcd8af.zip
llvm-e58ca59cf4d94c91c60e067b207b9ee8d3dcd8af.tar.gz
llvm-e58ca59cf4d94c91c60e067b207b9ee8d3dcd8af.tar.bz2
[StatepointLowering] Schedule gc relocates before uniqueing them
Otherwise we can see an "unexpected" gc.relocate that we uniqued away. llvm-svn: 264127
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index ad33906..eccebf2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -334,12 +334,6 @@ static void getIncomingStatepointGCValues(
Ptrs.push_back(Relocate->getDerivedPtr());
}
- // Remove any redundant llvm::Values which map to the same SDValue as another
- // input. Also has the effect of removing duplicates in the original
- // llvm::Value input list as well. This is a useful optimization for
- // reducing the size of the StackMap section. It has no other impact.
- removeDuplicatesGCPtrs(Bases, Ptrs, Relocs, Builder);
-
assert(Bases.size() == Ptrs.size() && Ptrs.size() == Relocs.size());
}
@@ -566,11 +560,21 @@ SDValue SelectionDAGBuilder::LowerAsSTATEPOINT(
StatepointLowering.startNewStatepoint(*this);
#ifndef NDEBUG
+ // We schedule gc relocates before removeDuplicatesGCPtrs since we _will_
+ // encounter the duplicate gc relocates we elide in removeDuplicatesGCPtrs.
for (auto *Reloc : SI.GCRelocates)
if (Reloc->getParent() == SI.StatepointInstr->getParent())
StatepointLowering.scheduleRelocCall(*Reloc);
#endif
+ // Remove any redundant llvm::Values which map to the same SDValue as another
+ // input. Also has the effect of removing duplicates in the original
+ // llvm::Value input list as well. This is a useful optimization for
+ // reducing the size of the StackMap section. It has no other impact.
+ removeDuplicatesGCPtrs(SI.Bases, SI.Ptrs, SI.GCRelocates, *this);
+ assert(SI.Bases.size() == SI.Ptrs.size() &&
+ SI.Ptrs.size() == SI.GCRelocates.size());
+
// Lower statepoint vmstate and gcstate arguments
SmallVector<SDValue, 10> LoweredMetaArgs;
lowerStatepointMetaArgs(LoweredMetaArgs, SI, *this);