summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-12-10 18:29:46 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-12-10 18:29:46 +0000
commitfc2c9af99c546d644757ae06b65df69f92897ab7 (patch)
treedede61036a2dd2836af42643c6f60c8b8e750417 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
parent17e53b9299666f43e5ac0d134b53cf5981274f45 (diff)
downloadbcm5719-llvm-fc2c9af99c546d644757ae06b65df69f92897ab7.tar.gz
bcm5719-llvm-fc2c9af99c546d644757ae06b65df69f92897ab7.zip
[TargetLowering] Add UNDEF folding to SimplifyDemandedVectorElts
If all the demanded elements of the SimplifyDemandedVectorElts are known to be UNDEF, we can simplify to an ISD::UNDEF node. Zero constant folding will be handled in a future patch - its a little trickier as we often have bitcasted zero values. Differential Revision: https://reviews.llvm.org/D55511 llvm-svn: 348784
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index b45453b52e1..1f5ea31c815 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1783,8 +1783,13 @@ bool TargetLowering::SimplifyDemandedVectorElts(
break;
}
}
-
assert((KnownUndef & KnownZero) == 0 && "Elements flagged as undef AND zero");
+
+ // Constant fold all undef cases.
+ // TODO: Handle zero cases as well.
+ if (DemandedElts.isSubsetOf(KnownUndef))
+ return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT));
+
return false;
}
OpenPOWER on IntegriCloud