From: Craig Topper Date: Wed, 27 Mar 2019 21:05:07 +0000 (+0000) Subject: [X86ISelDAGToDAG] Move initialization of OptForSize and OptForMinSize from Preprocess... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f4087193504e772c85ced4364aab38e994afab4;p=llvm [X86ISelDAGToDAG] Move initialization of OptForSize and OptForMinSize from PreprocessISelDAG to runOnMachineFunction. NFCI This makes more sense as a place to initialize these. I don't think runOnMachineFunction was overriden when these cached values were originally created. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357123 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index b52eead4ad4..89585d74cb8 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -181,6 +181,13 @@ namespace { Subtarget = &MF.getSubtarget(); IndirectTlsSegRefs = MF.getFunction().hasFnAttribute( "indirect-tls-seg-refs"); + + // OptFor[Min]Size are used in pattern predicates that isel is matching. + OptForSize = MF.getFunction().optForSize(); + OptForMinSize = MF.getFunction().optForMinSize(); + assert((!OptForMinSize || OptForSize) && + "OptForMinSize implies OptForSize"); + SelectionDAGISel::runOnMachineFunction(MF); return true; } @@ -738,11 +745,6 @@ static bool isCalleeLoad(SDValue Callee, SDValue &Chain, bool HasCallSeq) { } void X86DAGToDAGISel::PreprocessISelDAG() { - // OptFor[Min]Size are used in pattern predicates that isel is matching. - OptForSize = MF->getFunction().optForSize(); - OptForMinSize = MF->getFunction().optForMinSize(); - assert((!OptForMinSize || OptForSize) && "OptForMinSize implies OptForSize"); - for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(), E = CurDAG->allnodes_end(); I != E; ) { SDNode *N = &*I++; // Preincrement iterator to avoid invalidation issues.