[llvm] r352067 - [SelectionDAGBuilder] Simplify HasSideEffect calculation. NFC.
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 24 09:56:03 PST 2019
Author: niravd
Date: Thu Jan 24 09:56:03 2019
New Revision: 352067
URL: http://llvm.org/viewvc/llvm-project?rev=352067&view=rev
Log:
[SelectionDAGBuilder] Simplify HasSideEffect calculation. NFC.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=352067&r1=352066&r2=352067&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Thu Jan 24 09:56:03 2019
@@ -7505,9 +7505,9 @@ void SelectionDAGBuilder::visitInlineAsm
TargetLowering::AsmOperandInfoVector TargetConstraints = TLI.ParseConstraints(
DAG.getDataLayout(), DAG.getSubtarget().getRegisterInfo(), CS);
- bool hasMemory = false;
-
- // Remember the HasSideEffect, AlignStack, AsmDialect, MayLoad and MayStore
+ // First Pass: Calculate HasSideEffects and ExtraFlags (AlignStack,
+ // AsmDialect, MayLoad, MayStore).
+ bool HasSideEffect = IA->hasSideEffects();
ExtraFlags ExtraInfo(CS);
unsigned ArgNo = 0; // ArgNo - The argument of the CallInst.
@@ -7550,8 +7550,8 @@ void SelectionDAGBuilder::visitInlineAsm
OpInfo.ConstraintVT = MVT::Other;
}
- if (!hasMemory)
- hasMemory = OpInfo.hasMemory(TLI);
+ if (!HasSideEffect)
+ HasSideEffect = OpInfo.hasMemory(TLI);
// Determine if this InlineAsm MayLoad or MayStore based on the constraints.
// FIXME: Could we compute this on OpInfo rather than T?
@@ -7562,14 +7562,9 @@ void SelectionDAGBuilder::visitInlineAsm
ExtraInfo.update(T);
}
- SDValue Chain, Flag;
-
// We won't need to flush pending loads if this asm doesn't touch
// memory and is nonvolatile.
- if (hasMemory || IA->hasSideEffects())
- Chain = getRoot();
- else
- Chain = DAG.getRoot();
+ SDValue Flag, Chain = (HasSideEffect) ? getRoot() : DAG.getRoot();
// Second pass over the constraints: compute which constraint option to use.
for (SDISelAsmOperandInfo &OpInfo : ConstraintOperands) {
@@ -7925,8 +7920,7 @@ void SelectionDAGBuilder::visitInlineAsm
Chain = DAG.getNode(ISD::TokenFactor, getCurSDLoc(), MVT::Other, OutChains);
// Only Update Root if inline assembly has a memory effect.
- if (ResultValues.empty() || IA->hasSideEffects() || hasMemory ||
- !OutChains.empty())
+ if (ResultValues.empty() || HasSideEffect || !OutChains.empty())
DAG.setRoot(Chain);
}
More information about the llvm-commits
mailing list