[llvm] r367718 - [Statepoints] Fix overalignment of loads in no-realign-stack functions
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 13:17:37 PDT 2019
Author: reames
Date: Fri Aug 2 13:17:37 2019
New Revision: 367718
URL: http://llvm.org/viewvc/llvm-project?rev=367718&view=rev
Log:
[Statepoints] Fix overalignment of loads in no-realign-stack functions
This really should have been part of 366765. For some reason, I forgot to handle the corresponding load side, and the readable test cases (using deopt vs statepoints) turned out to be overly reduced. Oops.
As seen in the test change, the problem was that we were using a load with alignment expectations rather than the unaligned variant when the stack alignment was less than that prefered type alignment.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
llvm/trunk/test/CodeGen/X86/statepoint-no-realign-stack.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp?rev=367718&r1=367717&r2=367718&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp Fri Aug 2 13:17:37 2019
@@ -1016,20 +1016,27 @@ void SelectionDAGBuilder::visitGCRelocat
return;
}
- SDValue SpillSlot =
- DAG.getTargetFrameIndex(*DerivedPtrLocation, getFrameIndexTy());
+ unsigned Index = *DerivedPtrLocation;
+ SDValue SpillSlot = DAG.getTargetFrameIndex(Index, getFrameIndexTy());
// Note: We know all of these reloads are independent, but don't bother to
// exploit that chain wise. DAGCombine will happily do so as needed, so
// doing it here would be a small compile time win at most.
SDValue Chain = getRoot();
- SDValue SpillLoad =
- DAG.getLoad(DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
- Relocate.getType()),
- getCurSDLoc(), Chain, SpillSlot,
- MachinePointerInfo::getFixedStack(DAG.getMachineFunction(),
- *DerivedPtrLocation));
+ auto &MF = DAG.getMachineFunction();
+ auto &MFI = MF.getFrameInfo();
+ auto PtrInfo = MachinePointerInfo::getFixedStack(MF, Index);
+ auto *LoadMMO =
+ MF.getMachineMemOperand(PtrInfo, MachineMemOperand::MOLoad,
+ MFI.getObjectSize(Index),
+ MFI.getObjectAlignment(Index));
+
+ auto LoadVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
+ Relocate.getType());
+
+ SDValue SpillLoad = DAG.getLoad(LoadVT, getCurSDLoc(), Chain,
+ SpillSlot, LoadMMO);
DAG.setRoot(SpillLoad.getValue(1));
Modified: llvm/trunk/test/CodeGen/X86/statepoint-no-realign-stack.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/statepoint-no-realign-stack.ll?rev=367718&r1=367717&r2=367718&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/statepoint-no-realign-stack.ll (original)
+++ llvm/trunk/test/CodeGen/X86/statepoint-no-realign-stack.ll Fri Aug 2 13:17:37 2019
@@ -90,7 +90,7 @@ define <4 x i8 addrspace(1)*> @spillfill
; CHECK-NEXT: vzeroupper
; CHECK-NEXT: callq do_safepoint
; CHECK-NEXT: .Ltmp3:
-; CHECK-NEXT: vmovaps (%rsp), %ymm0
+; CHECK-NEXT: vmovups (%rsp), %ymm0
; CHECK-NEXT: addq $40, %rsp
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: retq
More information about the llvm-commits
mailing list