[llvm] r319695 - DAG: Follow-up to r319692 check the truncates inputs have the same type
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 12:48:50 PST 2017
Author: hans
Date: Mon Dec 4 12:48:50 2017
New Revision: 319695
URL: http://llvm.org/viewvc/llvm-project?rev=319695&view=rev
Log:
DAG: Follow-up to r319692 check the truncates inputs have the same type
MatchRotate assumes the types of the types of LHS and RHS are equal,
which is always the case then they come from an OR node, but here
we're getting them from two different TRUNC nodes, so we have to check
the types.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=319695&r1=319694&r2=319695&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Dec 4 12:48:50 2017
@@ -4653,7 +4653,8 @@ SDNode *DAGCombiner::MatchRotate(SDValue
if (!HasROTL && !HasROTR) return nullptr;
// Check for truncated rotate.
- if (LHS.getOpcode() == ISD::TRUNCATE && RHS.getOpcode() == ISD::TRUNCATE) {
+ if (LHS.getOpcode() == ISD::TRUNCATE && RHS.getOpcode() == ISD::TRUNCATE &&
+ LHS.getOperand(0).getValueType() == RHS.getOperand(0).getValueType()) {
assert(LHS.getValueType() == RHS.getValueType());
if (SDNode *Rot = MatchRotate(LHS.getOperand(0), RHS.getOperand(0), DL)) {
return DAG.getNode(ISD::TRUNCATE, SDLoc(LHS), LHS.getValueType(),
More information about the llvm-commits
mailing list