diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -5073,9 +5073,6 @@ // fold (abd c1, c2) if (SDValue C = DAG.FoldConstantArithmetic(Opcode, DL, VT, {N0, N1})) return C; - // reassociate if possible - if (SDValue C = reassociateOps(Opcode, DL, N0, N1, N->getFlags())) - return C; // canonicalize constant to RHS. if (DAG.isConstantIntBuildVectorOrConstantInt(N0) && diff --git a/llvm/test/CodeGen/AArch64/abd-combine.ll b/llvm/test/CodeGen/AArch64/abd-combine.ll --- a/llvm/test/CodeGen/AArch64/abd-combine.ll +++ b/llvm/test/CodeGen/AArch64/abd-combine.ll @@ -321,8 +321,10 @@ define <8 x i16> @abdu_i_reassoc(<8 x i16> %src1) { ; CHECK-LABEL: abdu_i_reassoc: ; CHECK: // %bb.0: -; CHECK-NEXT: movi v1.8h, #2 +; CHECK-NEXT: movi v1.8h, #3 +; CHECK-NEXT: movi v2.8h, #1 ; CHECK-NEXT: uabd v0.8h, v0.8h, v1.8h +; CHECK-NEXT: uabd v0.8h, v0.8h, v2.8h ; CHECK-NEXT: ret %r1 = call <8 x i16> @llvm.aarch64.neon.uabd.v8i16(<8 x i16> %src1, <8 x i16> ) %result = call <8 x i16> @llvm.aarch64.neon.uabd.v8i16(<8 x i16> %r1, <8 x i16> ) @@ -539,8 +541,10 @@ define <8 x i16> @abds_i_reassoc(<8 x i16> %src1) { ; CHECK-LABEL: abds_i_reassoc: ; CHECK: // %bb.0: -; CHECK-NEXT: movi v1.8h, #2 +; CHECK-NEXT: movi v1.8h, #3 +; CHECK-NEXT: movi v2.8h, #1 ; CHECK-NEXT: sabd v0.8h, v0.8h, v1.8h +; CHECK-NEXT: sabd v0.8h, v0.8h, v2.8h ; CHECK-NEXT: ret %r1 = call <8 x i16> @llvm.aarch64.neon.sabd.v8i16(<8 x i16> %src1, <8 x i16> ) %result = call <8 x i16> @llvm.aarch64.neon.sabd.v8i16(<8 x i16> %r1, <8 x i16> )