llvm.org GIT mirror llvm / 49c8f75
[TwoAddressInstructionPass] When looking for a 3 addr conversion after commuting, make sure regB has been updated to take into account the commute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249378 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 4 years ago
4 changed file(s) with 11 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
12641264 return true;
12651265 }
12661266
1267 // If we commuted, regB may have changed so we should re-sample it to avoid
1268 // confusing the three address conversion below.
1269 if (Commuted) {
1270 regB = MI.getOperand(SrcIdx).getReg();
1271 regBKilled = isKilled(MI, regB, MRI, TII, LIS, true);
1272 }
1273
12671274 if (MI.isConvertibleTo3Addr()) {
12681275 // This instruction is potentially convertible to a true
12691276 // three-address instruction. Check if it is profitable.
209209 ; X64-LABEL: add_32r_ret_load:
210210 ; X64-NOT: lock
211211 ; X64: movl (%rdi), %eax
212 ; X64-NEXT: leal (%rsi,%rax), %ecx
213 ; X64-NEXT: movl %ecx, (%rdi)
212 ; X64-NEXT: addl %eax, %esi
213 ; X64-NEXT: movl %esi, (%rdi)
214214 ; X64-NEXT: retq
215215 ; X32-LABEL: add_32r_ret_load:
216216 ; X32-NOT: lock
3838 entry:
3939 ; DARWIN-LABEL: t3:
4040 ; DARWIN: shlq $32, %rcx
41 ; DARWIN-NEXT: leaq (%rax,%rcx), %rax
41 ; DARWIN-NEXT: orq %rcx, %rax
4242 ; DARWIN-NEXT: shll $8
4343 ; DARWIN-NOT: leaq
4444 %tmp21 = zext i32 %lb to i64
2222 ; X32: add
2323 ; X32: add
2424 ; X32: add
25 ; X32: leal
25 ; X32: add
2626 ; X32: %for.body.3
2727 define void @sharedidx(i8* nocapture %a, i8* nocapture %b, i8* nocapture %c, i32 %s, i32 %len) nounwind ssp {
2828 entry: