[llvm] r203934 - x86: getCalleeSavedRegs() would crash on 0 (so don't default to it)
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Mar 14 08:38:12 PDT 2014
Author: dexonsmith
Date: Fri Mar 14 10:38:12 2014
New Revision: 203934
URL: http://llvm.org/viewvc/llvm-project?rev=203934&view=rev
Log:
x86: getCalleeSavedRegs() would crash on 0 (so don't default to it)
The current logic assumes that MF is not 0. Assert that it isn't, and
remove the default of 0 from the header.
Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.h
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=203934&r1=203933&r2=203934&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Mar 14 10:38:12 2014
@@ -237,6 +237,7 @@ X86RegisterInfo::getCalleeSavedRegs(cons
bool HasAVX = TM.getSubtarget<X86Subtarget>().hasAVX();
bool HasAVX512 = TM.getSubtarget<X86Subtarget>().hasAVX512();
+ assert(MF && "MachineFunction required");
switch (MF->getFunction()->getCallingConv()) {
case CallingConv::GHC:
case CallingConv::HiPE:
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=203934&r1=203933&r2=203934&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Fri Mar 14 10:38:12 2014
@@ -101,7 +101,7 @@ public:
/// getCalleeSavedRegs - Return a null-terminated list of all of the
/// callee-save registers on this target.
const uint16_t *
- getCalleeSavedRegs(const MachineFunction* MF = 0) const override;
+ getCalleeSavedRegs(const MachineFunction* MF) const override;
const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
const uint32_t *getNoPreservedMask() const;
More information about the llvm-commits
mailing list