summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-07 08:04:51 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2009-07-07 08:04:51 +0000
commit031bbef5283fa7bb98ab28997137482fe6d548c6 (patch)
tree03226665914f7515397efd8b790dc8b83da71d1f
parent6999b901466d76718c451ef290a82ea28b85036f (diff)
downloadbcm5719-llvm-031bbef5283fa7bb98ab28997137482fe6d548c6.tar.gz
bcm5719-llvm-031bbef5283fa7bb98ab28997137482fe6d548c6.zip
if the terminator is a branch depending upon the side effects of a
previous cmp; a copy can not be inserted here if the copy insn also has side effects. We don't have access to the attributes of copy insn here; so just play safe by finding a safe locations for branch terminators. llvm-svn: 74898
-rw-r--r--llvm/lib/CodeGen/PHIElimination.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index c5c76fc7946..9adf97cde5c 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -169,9 +169,15 @@ MachineBasicBlock::iterator PNE::FindCopyInsertPoint(MachineBasicBlock &MBB,
return MBB.begin();
// If this basic block does not contain an invoke, then control flow always
- // reaches the end of it, so place the copy there. The logic below works in
- // this case too, but is more expensive.
- if (!isa<InvokeInst>(MBB.getBasicBlock()->getTerminator()))
+ // reaches the end of it, so place the copy there.
+ // If the terminator is a branch depending upon the side effects of a
+ // previous cmp; a copy can not be inserted here if the copy insn also
+ // side effects. We don't have access to the attributes of copy insn here;
+ // so just play safe by finding a safe locations for branch terminators.
+ //
+ // The logic below works in this case too, but is more expensive.
+ const TerminatorInst *TermInst = MBB.getBasicBlock()->getTerminator();
+ if (!(isa<InvokeInst>(TermInst) || isa<BranchInst>(TermInst)))
return MBB.getFirstTerminator();
// Discover any definition/uses in this basic block.
OpenPOWER on IntegriCloud