[llvm] r355304 - [AArch64/ARM] Fix two compiler warnings in InstructionSelector, NFCI

Jonas Hahnfeld via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 00:51:32 PST 2019


Author: hahnfeld
Date: Mon Mar  4 00:51:32 2019
New Revision: 355304

URL: http://llvm.org/viewvc/llvm-project?rev=355304&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
    llvm/trunk/lib/Target/ARM/ARMInstructionSelector.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp?rev=355304&r1=355303&r2=355304&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp Mon Mar  4 00:51:32 2019
@@ -503,6 +503,7 @@ static bool selectCopy(MachineInstr &I,
           !TargetRegisterInfo::isPhysicalRegister(I.getOperand(1).getReg()))) &&
         "No phys reg on generic operator!");
     assert(KnownValid || isValidCopy(I, DstRegBank, MRI, TRI, RBI));
+    (void)KnownValid;
     return true;
   };
 

Modified: llvm/trunk/lib/Target/ARM/ARMInstructionSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstructionSelector.cpp?rev=355304&r1=355303&r2=355304&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstructionSelector.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstructionSelector.cpp Mon Mar  4 00:51:32 2019
@@ -665,11 +665,12 @@ bool ARMInstructionSelector::selectGloba
 
     // 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;




More information about the llvm-commits mailing list