summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-11-09 19:50:20 +0000
committerAdrian Prantl <aprantl@apple.com>2017-11-09 19:50:20 +0000
commit1c8c544946a21ee46261dee56ffc1fbea1515209 (patch)
treecf4c6fdfa363bba9b6aae07321c848c7b325e25f /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent18f21a483b863439ed19cdddb966dd9fe0464dcf (diff)
downloadbcm5719-llvm-1c8c544946a21ee46261dee56ffc1fbea1515209.tar.gz
bcm5719-llvm-1c8c544946a21ee46261dee56ffc1fbea1515209.zip
Preserve debug info when DAG-combinging (zext (truncate x)) -> (and x, mask).
rdar://problem/27139077 llvm-svn: 317825
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 86c4f2c3565..557cf6d5212 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -7613,7 +7613,11 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
if (!LegalOperations || TLI.isOperationLegal(ISD::AND, VT)) {
SDValue Op = DAG.getAnyExtOrTrunc(N0.getOperand(0), SDLoc(N), VT);
AddToWorklist(Op.getNode());
- return DAG.getZeroExtendInReg(Op, SDLoc(N), MinVT.getScalarType());
+ SDValue And = DAG.getZeroExtendInReg(Op, SDLoc(N), MinVT.getScalarType());
+ // We may safely transfer the debug info describing the truncate node over
+ // to the equivalent and operation.
+ DAG.transferDbgValues(N0, And);
+ return And;
}
}
OpenPOWER on IntegriCloud