[llvm-commits] [llvm] r74898 - /llvm/trunk/lib/CodeGen/PHIElimination.cpp
Sanjiv Gupta
sanjiv.gupta at microchip.com
Tue Jul 7 01:04:53 PDT 2009
Author: sgupta
Date: Tue Jul 7 03:04:51 2009
New Revision: 74898
URL: http://llvm.org/viewvc/llvm-project?rev=74898&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/PHIElimination.cpp
Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.cpp?rev=74898&r1=74897&r2=74898&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/PHIElimination.cpp Tue Jul 7 03:04:51 2009
@@ -169,9 +169,15 @@
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.
More information about the llvm-commits
mailing list