summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-12-16 14:57:04 +0000
committerSanjay Patel <spatel@rotateright.com>2018-12-16 14:57:04 +0000
commitf24900b9348343f6c415bc164b0745e912e671a5 (patch)
tree549f13963b29271a2a4a6a2046acb647e9a6429a /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parentaad3645fe1b22213d606c54f2342bbcf2871bf15 (diff)
downloadbcm5719-llvm-f24900b9348343f6c415bc164b0745e912e671a5.tar.gz
bcm5719-llvm-f24900b9348343f6c415bc164b0745e912e671a5.zip
[DAGCombiner] allow hoisting vector bitwise logic ahead of truncates
The transform performs a bitwise logic op in a wider type followed by truncate when both inputs are truncated from the same source type: logic_op (truncate x), (truncate y) --> truncate (logic_op x, y) There are a bunch of other checks that should prevent doing this when it might be harmful. We already do this transform for scalars in this spot. The vector limitation was shared with a check for the case when the operands are extended. I'm not sure if that limit is needed either, but that would be a separate patch. Differential Revision: https://reviews.llvm.org/D55448 llvm-svn: 349303
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 93a1ab1dcff..7a22caf9c8b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3755,11 +3755,8 @@ SDValue DAGCombiner::hoistLogicOpWithSameOpcodeHands(SDNode *N) {
// instructions without eliminating anything.
if (!N0.hasOneUse() && !N1.hasOneUse())
return SDValue();
- // We need matching integer source types.
- // Do not hoist logic op inside of a vector extend, since it may combine
- // into a vsetcc.
- // TODO: Should the vector check apply to truncate though?
- if (VT.isVector() || XVT != Y.getValueType())
+ // We need matching source types.
+ if (XVT != Y.getValueType())
return SDValue();
// Don't create an illegal op during or after legalization.
if (LegalOperations && !TLI.isOperationLegal(LogicOpcode, XVT))
OpenPOWER on IntegriCloud