Skip to content

Commit 2f1bba7

Browse files
committed
Revert "[AArch64][DebugInfo] Do not recompute CalleeSavedStackSize"
Summary: This reverts commit r372204. This change causes build bot failures under msan: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/35236/steps/check-llvm%20msan/logs/stdio: ``` FAIL: LLVM :: DebugInfo/AArch64/asan-stack-vars.mir (19531 of 33579) ******************** TEST 'LLVM :: DebugInfo/AArch64/asan-stack-vars.mir' FAILED ******************** Script: -- : 'RUN: at line 1'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc -O0 -start-before=livedebugvalues -filetype=obj -o - /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/DebugInfo/AArch64/asan-stack-vars.mir | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llvm-dwarfdump -v - | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/DebugInfo/AArch64/asan-stack-vars.mir -- Exit Code: 2 Command Output (stderr): -- ==62894==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0xdfcafb in llvm::AArch64FrameLowering::resolveFrameOffsetReference(llvm::MachineFunction const&, int, bool, unsigned int&, bool, bool) const /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp:1658:3 #1 0xdfae8a in resolveFrameIndexReference /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp:1580:10 #2 0xdfae8a in llvm::AArch64FrameLowering::getFrameIndexReference(llvm::MachineFunction const&, int, unsigned int&) const /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp:1536 #3 0x46642c1 in (anonymous namespace)::LiveDebugValues::extractSpillBaseRegAndOffset(llvm::MachineInstr const&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/CodeGen/LiveDebugValues.cpp:582:21 #4 0x4647cb3 in transferSpillOrRestoreInst /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/CodeGen/LiveDebugValues.cpp:883:11 #5 0x4647cb3 in process /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/CodeGen/LiveDebugValues.cpp:1079 #6 0x4647cb3 in (anonymous namespace)::LiveDebugValues::ExtendRanges(llvm::MachineFunction&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/CodeGen/LiveDebugValues.cpp:1361 #7 0x463ac0e in (anonymous namespace)::LiveDebugValues::runOnMachineFunction(llvm::MachineFunction&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/CodeGen/LiveDebugValues.cpp:1415:18 #8 0x4854ef0 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:13 #9 0x53b0b01 in llvm::FPPassManager::runOnFunction(llvm::Function&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1648:27 #10 0x53b15f6 in llvm::FPPassManager::runOnModule(llvm::Module&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1685:16 #11 0x53b298d in runOnModule /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1750:27 #12 0x53b298d in llvm::legacy::PassManagerImpl::run(llvm::Module&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1863 #13 0x905f21 in compileModule(char**, llvm::LLVMContext&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llc/llc.cpp:601:8 #14 0x8fdc4e in main /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llc/llc.cpp:355:22 #15 0x7f67673632e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #16 0x882369 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc+0x882369) MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp:1658:3 in llvm::AArch64FrameLowering::resolveFrameOffsetReference(llvm::MachineFunction const&, int, bool, unsigned int&, bool, bool) const Exiting error: -: The file was not recognized as a valid object file FileCheck error: '-' is empty. FileCheck command line: /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/DebugInfo/AArch64/asan-stack-vars.mir ``` Reviewers: bkramer Reviewed By: bkramer Subscribers: sdardis, aprantl, kristof.beyls, jrtc27, atanasyan, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67710 llvm-svn: 372228
1 parent d46bf63 commit 2f1bba7

10 files changed

+7
-131
lines changed

llvm/include/llvm/CodeGen/TargetFrameLowering.h

-8
Original file line numberDiff line numberDiff line change
@@ -281,21 +281,13 @@ class TargetFrameLowering {
281281
return getFrameIndexReference(MF, FI, FrameReg);
282282
}
283283

284-
/// Returns the callee-saved registers as computed by determineCalleeSaves
285-
/// in the BitVector \p SavedRegs.
286-
virtual void getCalleeSaves(const MachineFunction &MF,
287-
BitVector &SavedRegs) const;
288-
289284
/// This method determines which of the registers reported by
290285
/// TargetRegisterInfo::getCalleeSavedRegs() should actually get saved.
291286
/// The default implementation checks populates the \p SavedRegs bitset with
292287
/// all registers which are modified in the function, targets may override
293288
/// this function to save additional registers.
294289
/// This method also sets up the register scavenger ensuring there is a free
295290
/// register or a frameindex available.
296-
/// This method should not be called by any passes outside of PEI, because
297-
/// it may change state passed in by \p MF and \p RS. The preferred
298-
/// interface outside PEI is getCalleeSaves.
299291
virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
300292
RegScavenger *RS = nullptr) const;
301293

llvm/lib/CodeGen/LiveDebugValues.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,8 @@ bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) {
14091409
TRI = MF.getSubtarget().getRegisterInfo();
14101410
TII = MF.getSubtarget().getInstrInfo();
14111411
TFI = MF.getSubtarget().getFrameLowering();
1412-
TFI->getCalleeSaves(MF, CalleeSavedRegs);
1412+
TFI->determineCalleeSaves(MF, CalleeSavedRegs,
1413+
std::make_unique<RegScavenger>().get());
14131414
LS.initialize(MF);
14141415

14151416
bool Changed = ExtendRanges(MF);

llvm/lib/CodeGen/RegUsageInfoCollector.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class RegUsageInfoCollector : public MachineFunctionPass {
5656

5757
bool runOnMachineFunction(MachineFunction &MF) override;
5858

59-
// Call getCalleeSaves and then also set the bits for subregs and
59+
// Call determineCalleeSaves and then also set the bits for subregs and
6060
// fully saved superregs.
6161
static void computeCalleeSavedRegs(BitVector &SavedRegs, MachineFunction &MF);
6262

@@ -199,7 +199,7 @@ computeCalleeSavedRegs(BitVector &SavedRegs, MachineFunction &MF) {
199199

200200
// Target will return the set of registers that it saves/restores as needed.
201201
SavedRegs.clear();
202-
TFI.getCalleeSaves(MF, SavedRegs);
202+
TFI.determineCalleeSaves(MF, SavedRegs);
203203
if (SavedRegs.none())
204204
return;
205205

llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp

+1-14
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,6 @@ bool TargetFrameLowering::needsFrameIndexResolution(
5959
return MF.getFrameInfo().hasStackObjects();
6060
}
6161

62-
void TargetFrameLowering::getCalleeSaves(const MachineFunction &MF,
63-
BitVector &CalleeSaves) const {
64-
const TargetRegisterInfo &TRI = *MF.getSubtarget().getRegisterInfo();
65-
CalleeSaves.resize(TRI.getNumRegs());
66-
67-
const MachineFrameInfo &MFI = MF.getFrameInfo();
68-
if (!MFI.isCalleeSavedInfoValid())
69-
return;
70-
71-
for (const CalleeSavedInfo &Info : MFI.getCalleeSavedInfo())
72-
CalleeSaves.set(Info.getReg());
73-
}
74-
7562
void TargetFrameLowering::determineCalleeSaves(MachineFunction &MF,
7663
BitVector &SavedRegs,
7764
RegScavenger *RS) const {
@@ -140,4 +127,4 @@ int TargetFrameLowering::getInitialCFAOffset(const MachineFunction &MF) const {
140127
unsigned TargetFrameLowering::getInitialCFARegister(const MachineFunction &MF)
141128
const {
142129
llvm_unreachable("getInitialCFARegister() not implemented!");
143-
}
130+
}

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -2225,10 +2225,6 @@ void AArch64FrameLowering::determineCalleeSaves(MachineFunction &MF,
22252225
<< EstimatedStackSize + AlignedCSStackSize
22262226
<< " bytes.\n");
22272227

2228-
assert((!MFI.isCalleeSavedInfoValid() ||
2229-
AFI->getCalleeSavedStackSize() == AlignedCSStackSize) &&
2230-
"Should not invalidate callee saved info");
2231-
22322228
// Round up to register pair alignment to avoid additional SP adjustment
22332229
// instructions.
22342230
AFI->setCalleeSavedStackSize(AlignedCSStackSize);

llvm/lib/Target/ARM/ARMFrameLowering.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -2128,16 +2128,10 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
21282128
AFI->setLRIsSpilledForFarJump(true);
21292129
}
21302130
AFI->setLRIsSpilled(SavedRegs.test(ARM::LR));
2131-
}
2132-
2133-
void ARMFrameLowering::getCalleeSaves(const MachineFunction &MF,
2134-
BitVector &SavedRegs) const {
2135-
TargetFrameLowering::getCalleeSaves(MF, SavedRegs);
21362131

21372132
// If we have the "returned" parameter attribute which guarantees that we
21382133
// return the value which was passed in r0 unmodified (e.g. C++ 'structors),
21392134
// record that fact for IPRA.
2140-
const ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
21412135
if (AFI->getPreservesR0())
21422136
SavedRegs.set(ARM::R0);
21432137
}

llvm/lib/Target/ARM/ARMFrameLowering.h

-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ class ARMFrameLowering : public TargetFrameLowering {
5353
int ResolveFrameIndexReference(const MachineFunction &MF, int FI,
5454
unsigned &FrameReg, int SPAdj) const;
5555

56-
void getCalleeSaves(const MachineFunction &MF,
57-
BitVector &SavedRegs) const override;
5856
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
5957
RegScavenger *RS) const override;
6058

llvm/test/CodeGen/AArch64/wrong-callee-save-size-after-livedebugvariables.mir

-92
This file was deleted.

llvm/test/DebugInfo/MIR/Mips/live-debug-values-reg-copy.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: llc -start-before=prologepilog -stop-after=livedebugvalues %s -o - | FileCheck %s
1+
# RUN: llc -run-pass=livedebugvalues %s -o - | FileCheck %s
22
#
33
# This test tests tracking variables value transferring from one register to another.
44
# This example is altered additionally in order to test transferring from one float register

llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# RUN: llc -start-before=prologepilog -stop-after=livedebugvalues %s -o - | FileCheck %s
1+
# RUN: llc -run-pass=livedebugvalues %s -o - | FileCheck %s
22
#
33
# This test tests tracking variables value transferring from one register to another.
44
# This example is altered additionally in order to test transferring from one float register

0 commit comments

Comments
 (0)