summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetInstrInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/TargetInstrInfo.cpp')
-rw-r--r--llvm/lib/Target/TargetInstrInfo.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/llvm/lib/Target/TargetInstrInfo.cpp b/llvm/lib/Target/TargetInstrInfo.cpp
index fe5ee1d25e0..d1413510fff 100644
--- a/llvm/lib/Target/TargetInstrInfo.cpp
+++ b/llvm/lib/Target/TargetInstrInfo.cpp
@@ -60,22 +60,27 @@ MachineInstr *TargetInstrInfo::commuteInstruction(MachineInstr *MI) const {
return MI;
}
-void TargetInstrInfo::PredicateInstruction(MachineInstr *MI,
+bool TargetInstrInfo::PredicateInstruction(MachineInstr *MI,
std::vector<MachineOperand> &Cond) const {
+ bool MadeChange = false;
const TargetInstrDescriptor *TID = MI->getInstrDescriptor();
- assert((TID->Flags & M_PREDICABLE) &&
- "Predicating an unpredicable instruction!");
-
- for (unsigned j = 0, i = 0, e = MI->getNumOperands(); i != e; ++i) {
- if ((TID->OpInfo[i].Flags & M_PREDICATE_OPERAND)) {
- MachineOperand &MO = MI->getOperand(i);
- if (MO.isReg())
- MO.setReg(Cond[j].getReg());
- else if (MO.isImm())
- MO.setImm(Cond[j].getImmedValue());
- else if (MO.isMBB())
- MO.setMachineBasicBlock(Cond[j].getMachineBasicBlock());
- ++j;
+ if (TID->Flags & M_PREDICABLE) {
+ for (unsigned j = 0, i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ if ((TID->OpInfo[i].Flags & M_PREDICATE_OPERAND)) {
+ MachineOperand &MO = MI->getOperand(i);
+ if (MO.isReg()) {
+ MO.setReg(Cond[j].getReg());
+ MadeChange = true;
+ } else if (MO.isImm()) {
+ MO.setImm(Cond[j].getImmedValue());
+ MadeChange = true;
+ } else if (MO.isMBB()) {
+ MO.setMachineBasicBlock(Cond[j].getMachineBasicBlock());
+ MadeChange = true;
+ }
+ ++j;
+ }
}
}
+ return MadeChange;
}
OpenPOWER on IntegriCloud