[llvm] r307184 - {DAGCombiner] Fold (rot x, 0) -> x
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 5 11:27:11 PDT 2017
Author: rksimon
Date: Wed Jul 5 11:27:11 2017
New Revision: 307184
URL: http://llvm.org/viewvc/llvm-project?rev=307184&view=rev
Log:
{DAGCombiner] Fold (rot x, 0) -> x
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/test/CodeGen/X86/combine-rotates.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=307184&r1=307183&r2=307184&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jul 5 11:27:11 2017
@@ -5273,6 +5273,10 @@ SDValue DAGCombiner::visitRotate(SDNode
SDValue N1 = N->getOperand(1);
EVT VT = N->getValueType(0);
+ // fold (rot x, 0) -> x
+ if (isNullConstantOrNullSplatConstant(N1))
+ return N0;
+
// fold (rot* x, (trunc (and y, c))) -> (rot* x, (and (trunc y), (trunc c))).
if (N1.getOpcode() == ISD::TRUNCATE &&
N1.getOperand(0).getOpcode() == ISD::AND) {
Modified: llvm/trunk/test/CodeGen/X86/combine-rotates.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/combine-rotates.ll?rev=307184&r1=307183&r2=307184&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/combine-rotates.ll (original)
+++ llvm/trunk/test/CodeGen/X86/combine-rotates.ll Wed Jul 5 11:27:11 2017
@@ -59,7 +59,6 @@ define <4 x i32> @combine_vec_rot_rot_sp
define <4 x i32> @combine_vec_rot_rot_splat_zero(<4 x i32> %x) {
; XOP-LABEL: combine_vec_rot_rot_splat_zero:
; XOP: # BB#0:
-; XOP-NEXT: vprotd $0, %xmm0, %xmm0
; XOP-NEXT: retq
;
; AVX512-LABEL: combine_vec_rot_rot_splat_zero:
More information about the llvm-commits
mailing list