aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 824371c..aa5cdd2 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -460,6 +460,7 @@ private:
bool dupRetToEnableTailCallOpts(BasicBlock *BB, ModifyDT &ModifiedDT);
bool fixupDbgValue(Instruction *I);
bool fixupDPValue(DPValue &I);
+ bool fixupDPValuesOnInst(Instruction &I);
bool placeDbgValues(Function &F);
bool placePseudoProbes(Function &F);
bool canFormExtLd(const SmallVectorImpl<Instruction *> &MovedExts,
@@ -6986,6 +6987,11 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
// Increment the current iterator to skip all the rest of select instructions
// because they will be either "not lowered" or "all lowered" to branch.
CurInstIterator = std::next(LastSI->getIterator());
+ // Examine debug-info attached to the consecutive select instructions. They
+ // won't be individually optimised by optimizeInst, so we need to perform
+ // DPValue maintenence here instead.
+ for (SelectInst *SI : ArrayRef(ASI).drop_front())
+ fixupDPValuesOnInst(*SI);
bool VectorCond = !SI->getCondition()->getType()->isIntegerTy(1);
@@ -8141,8 +8147,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) {
bool AnyChange = false;
- for (DPValue &DPV : I->getDbgValueRange())
- AnyChange |= fixupDPValue(DPV);
+ AnyChange = fixupDPValuesOnInst(*I);
// Bail out if we inserted the instruction to prevent optimizations from
// stepping on each other's toes.
@@ -8408,6 +8413,13 @@ bool CodeGenPrepare::fixupDbgValue(Instruction *I) {
return AnyChange;
}
+bool CodeGenPrepare::fixupDPValuesOnInst(Instruction &I) {
+ bool AnyChange = false;
+ for (DPValue &DPV : I.getDbgValueRange())
+ AnyChange |= fixupDPValue(DPV);
+ return AnyChange;
+}
+
// FIXME: should updating debug-info really cause the "changed" flag to fire,
// which can cause a function to be reprocessed?
bool CodeGenPrepare::fixupDPValue(DPValue &DPV) {