summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-10-06 05:39:59 +0000
committerCraig Topper <craig.topper@gmail.com>2015-10-06 05:39:59 +0000
commit2c4068f40966bd72277d4cc29540aee669611f96 (patch)
tree871c70d1269140955f9e50aa3a8cdf8d621c36dd /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
parentacdff168e2e3000d0db7eddd16fef7f238e28ea0 (diff)
downloadbcm5719-llvm-2c4068f40966bd72277d4cc29540aee669611f96.tar.gz
bcm5719-llvm-2c4068f40966bd72277d4cc29540aee669611f96.zip
[TwoAddressInstructionPass] When looking for a 3 addr conversion after commuting, make sure regB has been updated to take into account the commute.
llvm-svn: 249378
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r--llvm/lib/CodeGen/TwoAddressInstructionPass.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 717b07ca059..1b4fe705eb8 100644
--- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -1265,6 +1265,13 @@ tryInstructionTransform(MachineBasicBlock::iterator &mi,
return true;
}
+ // If we commuted, regB may have changed so we should re-sample it to avoid
+ // confusing the three address conversion below.
+ if (Commuted) {
+ regB = MI.getOperand(SrcIdx).getReg();
+ regBKilled = isKilled(MI, regB, MRI, TII, LIS, true);
+ }
+
if (MI.isConvertibleTo3Addr()) {
// This instruction is potentially convertible to a true
// three-address instruction. Check if it is profitable.
OpenPOWER on IntegriCloud