From: Hans Wennborg Date: Mon, 4 Dec 2017 20:48:50 +0000 (+0000) Subject: DAG: Follow-up to r319692 check the truncates inputs have the same type X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ef874fef746cc4e9b6d51f9bd213a42868e64fe;p=llvm 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319695 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 30195ff4e91..ffce8545a14 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -4653,7 +4653,8 @@ SDNode *DAGCombiner::MatchRotate(SDValue LHS, SDValue RHS, const SDLoc &DL) { 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(),