diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-10-06 05:39:59 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-10-06 05:39:59 +0000 |
commit | 2c4068f40966bd72277d4cc29540aee669611f96 (patch) | |
tree | 871c70d1269140955f9e50aa3a8cdf8d621c36dd /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | |
parent | acdff168e2e3000d0db7eddd16fef7f238e28ea0 (diff) | |
download | bcm5719-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.cpp | 7 |
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. |