Reset the subtarget for DAGToDAG on every iteration of runOnMachineFunction.
authorEric Christopher <echristo@gmail.com>
Thu, 22 May 2014 01:07:21 +0000 (01:07 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 22 May 2014 01:07:21 +0000 (01:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209374 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM64/ARM64ISelDAGToDAG.cpp

index 4a1f9717bf73a9293299fed7c901726cd1c15288..45a837e69f666d154909b3af6b010ab52462e2e4 100644 (file)
@@ -45,7 +45,7 @@ class ARM64DAGToDAGISel : public SelectionDAGISel {
 public:
   explicit ARM64DAGToDAGISel(ARM64TargetMachine &tm, CodeGenOpt::Level OptLevel)
       : SelectionDAGISel(tm, OptLevel), TM(tm),
-        Subtarget(&TM.getSubtarget<ARM64Subtarget>()), ForCodeSize(false) {}
+        Subtarget(nullptr), ForCodeSize(false) {}
 
   const char *getPassName() const override {
     return "ARM64 Instruction Selection";
@@ -57,6 +57,7 @@ public:
         FnAttrs.hasAttribute(AttributeSet::FunctionIndex,
                              Attribute::OptimizeForSize) ||
         FnAttrs.hasAttribute(AttributeSet::FunctionIndex, Attribute::MinSize);
+    Subtarget = &TM.getSubtarget<ARM64Subtarget>();
     return SelectionDAGISel::runOnMachineFunction(MF);
   }