llvm.org GIT mirror llvm / 4a9f150
When TCO is turned on, it is possible to end up with aliasing FrameIndex's. Therefore, CombinerAA cannot assume that different FrameIndex's never alias, but can instead use MachineFrameInfo to get the actual offsets of these slots and check for actual aliasing. This fixes CodeGen/X86/2010-02-19-TailCallRetAddrBug.ll and CodeGen/X86/tailcallstack64.ll when CombinerAA is enabled, modulo a different register allocation sequence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114348 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 9 years ago
2 changed file(s) with 17 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
70297029 if (Base1 == Base2 || (GV1 && (GV1 == GV2)) || (CV1 && (CV1 == CV2)))
70307030 return !((Offset1 + Size1) <= Offset2 || (Offset2 + Size2) <= Offset1);
70317031
7032 // If we know what the bases are, and they aren't identical, then we know they
7033 // cannot alias.
7032 // It is possible for different frame indices to alias each other, mostly
7033 // when tail call optimization reuses return address slots for arguments.
7034 // To catch this case, look up the actual index of frame indices to compute
7035 // the real alias relationship.
7036 if (isFrameIndex1 && isFrameIndex2) {
7037 MachineFrameInfo *MFI = DAG.getMachineFunction().getFrameInfo();
7038 Offset1 += MFI->getObjectOffset(cast(Base1)->getIndex());
7039 Offset2 += MFI->getObjectOffset(cast(Base2)->getIndex());
7040 return !((Offset1 + Size1) <= Offset2 || (Offset2 + Size2) <= Offset1);
7041 }
7042
7043 // Otherwise, if we know what the bases are, and they aren't identical, then
7044 // we know they cannot alias.
70347045 if ((isFrameIndex1 || CV1 || GV1) && (isFrameIndex2 || CV2 || GV2))
70357046 return false;
70367047
1818 }
1919
2020 ; CHECK: movq ___stack_chk_guard@GOTPCREL(%rip), %rax
21 ; CHECK: movb (%rsp), %dl
22 ; CHECK-NEXT: movb 30(%rsp), %sil
23 ; CHECK: movb %dl, (%rsp)
24 ; CHECK-NEXT: movb %sil, 30(%rsp)
21 ; CHECK: movb 30(%rsp), %dl
22 ; CHECK: movb (%rsp), %sil
23 ; CHECK: movb %sil, (%rsp)
24 ; CHECK: movb %dl, 30(%rsp)
2525 ; CHECK: callq ___stack_chk_fail