Skip to content

Commit 90c326b

Browse files
committed
[AArch64] Fix gcc warning about mix of enumeral and non-enumeral types [NFC]
Change the return type of findScratchNonCalleeSaveRegister to Register instead of unsigned. Every place the function is called we already put the returned value in a Register variable or compare it with another Register. This fixes some gcc warnings: ../lib/Target/AArch64/AArch64FrameLowering.cpp:744: warning: enumeral and non-enumeral type in conditional expression [-Wextra] 743 | Register TargetReg = RealignmentPadding | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | ? findScratchNonCalleeSaveRegister(&MBB) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | : AArch64::SP; | ../lib/Target/AArch64/AArch64FrameLowering.cpp:803: warning: enumeral and non-enumeral type in conditional expression [-Wextra] 802 | Register ScratchReg = RealignmentPadding | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 803 | ? findScratchNonCalleeSaveRegister(&MBB) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | : AArch64::SP; |
1 parent df08350 commit 90c326b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static int64_t getArgumentStackToRestore(MachineFunction &MF,
296296
static bool produceCompactUnwindFrame(MachineFunction &MF);
297297
static bool needsWinCFI(const MachineFunction &MF);
298298
static StackOffset getSVEStackSize(const MachineFunction &MF);
299-
static unsigned findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB);
299+
static Register findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB);
300300

301301
/// Returns true if a homogeneous prolog or epilog code can be emitted
302302
/// for the size optimization. If possible, a frame helper call is injected.
@@ -1013,7 +1013,7 @@ static void getLiveRegsForEntryMBB(LivePhysRegs &LiveRegs,
10131013
// but we would then have to make sure that we were in fact saving at least one
10141014
// callee-save register in the prologue, which is additional complexity that
10151015
// doesn't seem worth the benefit.
1016-
static unsigned findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB) {
1016+
static Register findScratchNonCalleeSaveRegister(MachineBasicBlock *MBB) {
10171017
MachineFunction *MF = MBB->getParent();
10181018

10191019
// If MBB is an entry block, use X9 as the scratch register

0 commit comments

Comments
 (0)