Skip to content

Commit

Permalink
[AArch64/ARM] Fix two compiler warnings in InstructionSelector, NFCI
Browse files Browse the repository at this point in the history
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

llvm-svn: 355304
  • Loading branch information
hahnjo committed Mar 4, 2019
1 parent daea28a commit 65a401f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ static bool selectCopy(MachineInstr &I, const TargetInstrInfo &TII,
!TargetRegisterInfo::isPhysicalRegister(I.getOperand(1).getReg()))) &&
"No phys reg on generic operator!");
assert(KnownValid || isValidCopy(I, DstRegBank, MRI, TRI, RBI));
(void)KnownValid;
return true;
};

Expand Down
11 changes: 6 additions & 5 deletions llvm/lib/Target/ARM/ARMInstructionSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,11 +665,12 @@ bool ARMInstructionSelector::selectGlobal(MachineInstrBuilder &MIB,

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

int TargetFlags = ARMII::MO_NO_FLAG;
Expand Down

0 comments on commit 65a401f

Please sign in to comment.