Add -verify-arm-pseudo-expand.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 29 Jul 2011 00:27:32 +0000 (00:27 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 29 Jul 2011 00:27:32 +0000 (00:27 +0000)
This hidden llc option runs the machine code verifier after expanding
ARM pseudo-instructions, but before if-conversion.

The machine code verifier is much better at pointing out liveness errors
that can trip up the register scavenger.

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

lib/Target/ARM/ARMExpandPseudoInsts.cpp
test/CodeGen/ARM/crash.ll

index d400cebc89be1cc153635a3f781bde12ce870e2b..a4fcfd51bfd60f2aaf13a4bd71dec682b216c23a 100644 (file)
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/Target/TargetFrameLowering.h"
 #include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h" // FIXME: for debug only. remove!
 using namespace llvm;
 
+cl::opt<bool>
+VerifyARMPseudo("verify-arm-pseudo-expand", cl::Hidden,
+                cl::desc("Verify machine code after expanding ARM pseudos"));
+
 namespace {
   class ARMExpandPseudo : public MachineFunctionPass {
   public:
@@ -1328,6 +1333,8 @@ bool ARMExpandPseudo::runOnMachineFunction(MachineFunction &MF) {
   for (MachineFunction::iterator MFI = MF.begin(), E = MF.end(); MFI != E;
        ++MFI)
     Modified |= ExpandMBB(*MFI);
+  if (VerifyARMPseudo)
+    MF.verify(this, "After expanding ARM pseudo instructions.");
   return Modified;
 }
 
index 5ecfe15511b9e897d7ae34747f3babe887ff155b..979442accf027838998bb18e064c9e4b77ee9684 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=thumbv7-apple-darwin10
+; RUN: llc < %s -mtriple=thumbv7-apple-darwin10 -verify-arm-pseudo-expand
 
 ; <rdar://problem/8529919>
 %struct.foo = type { i32, i32 }