]> granicus.if.org Git - llvm/commitdiff
[ARM GlobalISel] Move the check for Thumb higher up
authorDiana Picus <diana.picus@linaro.org>
Fri, 3 Nov 2017 10:30:12 +0000 (10:30 +0000)
committerDiana Picus <diana.picus@linaro.org>
Fri, 3 Nov 2017 10:30:12 +0000 (10:30 +0000)
We're currently bailing out for Thumb targets while lowering formal
parameters, but there used to be some other checks before it, which
could've caused some functions (e.g. those without formal parameters) to
sneak through unnoticed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317312 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMCallLowering.cpp

index e1323cd9427ee0408a5202c6ec830a3b5d944729..9c10a1c79a4220977b097faeb73471fde35c6291 100644 (file)
@@ -417,6 +417,12 @@ struct FormalArgHandler : public IncomingValueHandler {
 bool ARMCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
                                            const Function &F,
                                            ArrayRef<unsigned> VRegs) const {
+  auto &TLI = *getTLI<ARMTargetLowering>();
+  auto Subtarget = TLI.getSubtarget();
+
+  if (Subtarget->isThumb())
+    return false;
+
   // Quick exit if there aren't any args
   if (F.arg_empty())
     return true;
@@ -427,12 +433,6 @@ bool ARMCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
   auto &MF = MIRBuilder.getMF();
   auto &MBB = MIRBuilder.getMBB();
   auto DL = MF.getDataLayout();
-  auto &TLI = *getTLI<ARMTargetLowering>();
-
-  auto Subtarget = TLI.getSubtarget();
-
-  if (Subtarget->isThumb())
-    return false;
 
   for (auto &Arg : F.args())
     if (!isSupportedType(DL, TLI, Arg.getType()))