diff options
| author | Craig Topper <craig.topper@intel.com> | 2019-05-13 22:17:13 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2019-05-13 22:17:13 +0000 |
| commit | e2966473ddf3fcae3b88e65886b9ac7a46bfbe93 (patch) | |
| tree | 84c84bc6ec06ee3aa084ad07a8b5b9c4798bb805 | |
| parent | 946957189d6b43a3d2079403633c183224813f95 (diff) | |
| download | bcm5719-llvm-e2966473ddf3fcae3b88e65886b9ac7a46bfbe93.tar.gz bcm5719-llvm-e2966473ddf3fcae3b88e65886b9ac7a46bfbe93.zip | |
[X86] Use ISD::MERGE_VALUES to return from lowerAtomicArith instead of calling ReplaceAllUsesOfValueWith and returning SDValue().
Returning SDValue() makes the caller think that nothing happened and it will
end up executing the Expand path. This generates extra nodes that will need to
be pruned as dead code.
Returning an ISD::MERGE_VALUES will tell the caller that we'd like to make a
change and it will take care of replacing uses. This will prevent falling into
the Expand path.
llvm-svn: 360627
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 65f3af3f544..3133ddd2a82 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -26404,13 +26404,17 @@ static SDValue lowerAtomicArith(SDValue N, SelectionDAG &DAG, // traffic. This assumes that stack locations are very likely to be // accessed only by the owning thread. SDValue NewChain = emitLockedStackOp(DAG, Subtarget, Chain, DL); - DAG.ReplaceAllUsesOfValueWith(N.getValue(1), NewChain); - return SDValue(); + assert(!N->hasAnyUseOfValue(0)); + // NOTE: The getUNDEF is needed to give something for the unused result 0. + return DAG.getNode(ISD::MERGE_VALUES, DL, N->getVTList(), + DAG.getUNDEF(VT), NewChain); } // MEMBARRIER is a compiler barrier; it codegens to a no-op. SDValue NewChain = DAG.getNode(X86ISD::MEMBARRIER, DL, MVT::Other, Chain); - DAG.ReplaceAllUsesOfValueWith(N.getValue(1), NewChain); - return SDValue(); + assert(!N->hasAnyUseOfValue(0)); + // NOTE: The getUNDEF is needed to give something for the unused result 0. + return DAG.getNode(ISD::MERGE_VALUES, DL, N->getVTList(), + DAG.getUNDEF(VT), NewChain); } SDValue LockOp = lowerAtomicArithWithLOCK(N, DAG, Subtarget); |

