summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-08-12 10:56:05 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-08-12 10:56:05 +0000
commit05e8209e3347f636e93af9182c913259ec2bbffa (patch)
tree96ff6221c7582dcec6d7fc409b58f7bf40b34a2b /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
parentef58804ebc196fe54731e31d7db817471038084c (diff)
downloadbcm5719-llvm-05e8209e3347f636e93af9182c913259ec2bbffa.tar.gz
bcm5719-llvm-05e8209e3347f636e93af9182c913259ec2bbffa.zip
[TargetLowering] SimplifyDemandedBits - call SimplifyMultipleUseDemandedBits for ISD::TRUNCATE
llvm-svn: 368553
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 411d146e2ab..9027bea0390 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1700,6 +1700,11 @@ bool TargetLowering::SimplifyDemandedBits(
return true;
Known = Known.trunc(BitWidth);
+ // Attempt to avoid multi-use ops if we don't need anything from them.
+ if (SDValue NewSrc = SimplifyMultipleUseDemandedBits(
+ Src, TruncMask, DemandedElts, TLO.DAG, Depth + 1))
+ return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::TRUNCATE, dl, VT, NewSrc));
+
// If the input is only used by this truncate, see if we can shrink it based
// on the known demanded bits.
if (Src.getNode()->hasOneUse()) {
OpenPOWER on IntegriCloud