diff options
author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-07-07 08:04:51 +0000 |
---|---|---|
committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-07-07 08:04:51 +0000 |
commit | 73c96a7e95b084ec58ee4e0289066cf76dfbd2f7 (patch) | |
tree | 9ee91ff066a9ebf54d78d20af9b157b333a49340 /lib/CodeGen/PHIElimination.cpp | |
parent | cd0ae28436ee134eed18e9297ea4ce9abe1cb72f (diff) | |
download | external_llvm-73c96a7e95b084ec58ee4e0289066cf76dfbd2f7.zip external_llvm-73c96a7e95b084ec58ee4e0289066cf76dfbd2f7.tar.gz external_llvm-73c96a7e95b084ec58ee4e0289066cf76dfbd2f7.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74898 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PHIElimination.cpp')
-rw-r--r-- | lib/CodeGen/PHIElimination.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index c5c76fc..9adf97c 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/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. |