Skip to content

Commit dd6e8b9

Browse files
committed
[AArch64/ARM] Fix two compiler warnings in InstructionSelector, NFCI
1) GCC complains that KnownValid is set but not used. 2) In ARMInstructionSelector::selectGlobal() the code is mixing "enumeral and non-enumeral type in conditional expression". Solve this by casting to unsigned which is the final type anyway. Differential Revision: https://reviews.llvm.org/D58834 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355304 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent a505675 commit dd6e8b9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/Target/AArch64/AArch64InstructionSelector.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ static bool selectCopy(MachineInstr &I, const TargetInstrInfo &TII,
503503
!TargetRegisterInfo::isPhysicalRegister(I.getOperand(1).getReg()))) &&
504504
"No phys reg on generic operator!");
505505
assert(KnownValid || isValidCopy(I, DstRegBank, MRI, TRI, RBI));
506+
(void)KnownValid;
506507
return true;
507508
};
508509

lib/Target/ARM/ARMInstructionSelector.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,12 @@ bool ARMInstructionSelector::selectGlobal(MachineInstrBuilder &MIB,
665665

666666
// FIXME: Taking advantage of MOVT for ELF is pretty involved, so we don't
667667
// support it yet. See PR28229.
668-
unsigned Opc = UseMovt && !STI.isTargetELF()
669-
? (UseOpcodeThatLoads ? ARM::MOV_ga_pcrel_ldr
670-
: Opcodes.MOV_ga_pcrel)
671-
: (UseOpcodeThatLoads ? ARM::LDRLIT_ga_pcrel_ldr
672-
: Opcodes.LDRLIT_ga_pcrel);
668+
unsigned Opc =
669+
UseMovt && !STI.isTargetELF()
670+
? (UseOpcodeThatLoads ? (unsigned)ARM::MOV_ga_pcrel_ldr
671+
: Opcodes.MOV_ga_pcrel)
672+
: (UseOpcodeThatLoads ? (unsigned)ARM::LDRLIT_ga_pcrel_ldr
673+
: Opcodes.LDRLIT_ga_pcrel);
673674
MIB->setDesc(TII.get(Opc));
674675

675676
int TargetFlags = ARMII::MO_NO_FLAG;

0 commit comments

Comments
 (0)