1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[SelectionDAGBuilder] Simplify HasSideEffect calculation. NFC.

llvm-svn: 352067
This commit is contained in:
Nirav Dave 2019-01-24 17:56:03 +00:00
parent 89f6dbd753
commit 19969315fc

View File

@ -7505,9 +7505,9 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCallSite CS) {
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(ImmutableCallSite CS) {
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(ImmutableCallSite CS) {
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(ImmutableCallSite CS) {
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);
}