summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2013-07-22 17:45:55 +0000
committerJim Grosbach <grosbach@apple.com>2013-07-22 17:45:55 +0000
commit3f11faef0dfa5aba292a814c6cb20e0958a83c9a (patch)
treef8532fb305410884e89dccf988b921df99f2bbd9 /llvm
parent8c45d4b27fbd55728aacadda29f06982af62f358 (diff)
downloadbcm5719-llvm-3f11faef0dfa5aba292a814c6cb20e0958a83c9a.tar.gz
bcm5719-llvm-3f11faef0dfa5aba292a814c6cb20e0958a83c9a.zip
MC: mayAffectControlFlow() handling for variadic instructions.
Variadic MC instructions don't note whether the variable operands are uses or defs, so mayAffectControlFlow() must conservatively assume they are defs and return true if the PC is in the operand list. rdar://14488628 llvm-svn: 186846
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/MC/MCInstrDesc.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/include/llvm/MC/MCInstrDesc.h b/llvm/include/llvm/MC/MCInstrDesc.h
index 9b5415add24..310f7068771 100644
--- a/llvm/include/llvm/MC/MCInstrDesc.h
+++ b/llvm/include/llvm/MC/MCInstrDesc.h
@@ -268,8 +268,20 @@ public:
if (isBranch() || isCall() || isReturn() || isIndirectBranch())
return true;
unsigned PC = RI.getProgramCounter();
- if (PC == 0) return false;
- return hasDefOfPhysReg(MI, PC, RI);
+ if (PC == 0)
+ return false;
+ if (hasDefOfPhysReg(MI, PC, RI))
+ return true;
+ // A variadic instruction may define PC in the variable operand list.
+ // There's currently no indication of which entries in a variable
+ // list are defs and which are uses. While that's the case, this function
+ // needs to assume they're defs in order to be conservatively correct.
+ for (int i = NumOperands, e = MI.getNumOperands(); i != e; ++i) {
+ if (MI.getOperand(i).isReg() &&
+ RI.isSubRegisterEq(PC, MI.getOperand(i).getReg()))
+ return true;
+ }
+ return false;
}
/// \brief Return true if this instruction has a predicate operand
OpenPOWER on IntegriCloud