diff options
author | Mikael Holmen <mikael.holmen@ericsson.com> | 2017-12-12 07:29:57 +0000 |
---|---|---|
committer | Mikael Holmen <mikael.holmen@ericsson.com> | 2017-12-12 07:29:57 +0000 |
commit | 66cf383761f40ef1f622ea6224d4497a65a32668 (patch) | |
tree | cfd14f2dc449c98a31a3d85d8c6daf5e0248dc5a /llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp | |
parent | 468a813315193cc86f8d51b953c3f6038cd07e9f (diff) | |
download | bcm5719-llvm-66cf383761f40ef1f622ea6224d4497a65a32668.tar.gz bcm5719-llvm-66cf383761f40ef1f622ea6224d4497a65a32668.zip |
[CallSiteSplitting] Don't let debug intrinsics affect optimizations
Summary:
This solves PR35616.
We don't want the compiler to generate different code when we compile
with/without -g, so we now ignore debug intrinsics when determining if
the optimization can trigger or not.
Reviewers: junbuml
Subscribers: davide, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D41068
llvm-svn: 320460
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp index d53968be612..1a8d231ddb8 100644 --- a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp +++ b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp @@ -221,7 +221,7 @@ static bool canSplitCallSite(CallSite CS) { // call instruction, and we do not move a call-site across any other // instruction. BasicBlock *CallSiteBB = Instr->getParent(); - if (Instr != CallSiteBB->getFirstNonPHI()) + if (Instr != CallSiteBB->getFirstNonPHIOrDbg()) return false; // Need 2 predecessors and cannot split an edge from an IndirectBrInst. @@ -278,7 +278,7 @@ static void splitCallSite(CallSite CS, BasicBlock *PredBB1, BasicBlock *PredBB2, Instruction *CallInst1, Instruction *CallInst2) { Instruction *Instr = CS.getInstruction(); BasicBlock *TailBB = Instr->getParent(); - assert(Instr == (TailBB->getFirstNonPHI()) && "Unexpected call-site"); + assert(Instr == (TailBB->getFirstNonPHIOrDbg()) && "Unexpected call-site"); BasicBlock *SplitBlock1 = SplitBlockPredecessors(TailBB, PredBB1, ".predBB1.split"); @@ -315,7 +315,8 @@ static void splitCallSite(CallSite CS, BasicBlock *PredBB1, BasicBlock *PredBB2, // Replace users of the original call with a PHI mering call-sites split. if (Instr->getNumUses()) { - PHINode *PN = PHINode::Create(Instr->getType(), 2, "phi.call", Instr); + PHINode *PN = PHINode::Create(Instr->getType(), 2, "phi.call", + TailBB->getFirstNonPHI()); PN->addIncoming(CallInst1, SplitBlock1); PN->addIncoming(CallInst2, SplitBlock2); Instr->replaceAllUsesWith(PN); @@ -334,7 +335,7 @@ static void splitCallSite(CallSite CS, BasicBlock *PredBB1, BasicBlock *PredBB2, static bool isPredicatedOnPHI(CallSite CS) { Instruction *Instr = CS.getInstruction(); BasicBlock *Parent = Instr->getParent(); - if (Instr != Parent->getFirstNonPHI()) + if (Instr != Parent->getFirstNonPHIOrDbg()) return false; for (auto &BI : *Parent) { |