diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2010-12-14 21:34:53 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2010-12-14 21:34:53 +0000 |
| commit | 19dc77cec6b66adacc5663ed3afb7ab4aabe57a9 (patch) | |
| tree | e49798ac3cc84990fe41c028bfd27eb4a0c20be7 /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | |
| parent | d96bd53d0422955dd3237c0f5805d02e973f3812 (diff) | |
| download | bcm5719-llvm-19dc77cec6b66adacc5663ed3afb7ab4aabe57a9.tar.gz bcm5719-llvm-19dc77cec6b66adacc5663ed3afb7ab4aabe57a9.zip | |
Fix a minor bug in two-address pass. It was missing a commute opportunity.
regB = move RCX
regA = op regB, regC
RAX = move regA
where both regB and regC are killed. If regB is constrainted to non-compatible
physical registers but regC is not constrainted at all, then it's better to
commute the instruction.
movl %edi, %eax
shlq $32, %rcx
leaq (%rcx,%rax), %rax
=>
movl %edi, %eax
shlq $32, %rcx
orq %rcx, %rax
rdar://8762995
llvm-svn: 121793
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp index f4cca259c9a..60086ce224e 100644 --- a/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -554,7 +554,8 @@ TwoAddressInstructionPass::isProfitableToCommute(unsigned regB, unsigned regC, unsigned ToRegB = getMappedReg(regB, DstRegMap); unsigned ToRegC = getMappedReg(regC, DstRegMap); if (!regsAreCompatible(FromRegB, ToRegB, TRI) && - (regsAreCompatible(FromRegB, ToRegC, TRI) || + ((!FromRegC && !ToRegC) || + regsAreCompatible(FromRegB, ToRegC, TRI) || regsAreCompatible(FromRegC, ToRegB, TRI))) return true; |

