summaryrefslogtreecommitdiff
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-15 23:42:54 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-15 23:42:54 +0000
commita230262791397c88beeb7ca9bb97c8a8a026e848 (patch)
tree7fd8481d43710b3af30a7d8abad71731ac2b0c9e /lib/CodeGen/BranchFolding.cpp
parente746186ed4f61bf5eba13112cb8419c95cf58e52 (diff)
downloadllvm-a230262791397c88beeb7ca9bb97c8a8a026e848.tar.gz
llvm-a230262791397c88beeb7ca9bb97c8a8a026e848.tar.bz2
llvm-a230262791397c88beeb7ca9bb97c8a8a026e848.tar.xz
Handle register masks in branch folding.
Don't attempt to move instructions with regmask operands. They are most likely calls anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150634 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 4929e38890..6aa170b536 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -1477,6 +1477,9 @@ MachineBasicBlock::iterator findHoistingInsertPosAndDeps(MachineBasicBlock *MBB,
bool IsDef = false;
for (unsigned i = 0, e = PI->getNumOperands(); !IsDef && i != e; ++i) {
const MachineOperand &MO = PI->getOperand(i);
+ // If PI has a regmask operand, it is probably a call. Separate away.
+ if (MO.isRegMask())
+ return Loc;
if (!MO.isReg() || MO.isUse())
continue;
unsigned Reg = MO.getReg();
@@ -1589,6 +1592,11 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
bool IsSafe = true;
for (unsigned i = 0, e = TIB->getNumOperands(); i != e; ++i) {
MachineOperand &MO = TIB->getOperand(i);
+ // Don't attempt to hoist instructions with register masks.
+ if (MO.isRegMask()) {
+ IsSafe = false;
+ break;
+ }
if (!MO.isReg())
continue;
unsigned Reg = MO.getReg();