[PATCH] D158852: [SDAG] Add computeKnownBits support for ISD::SPLAT_VECTOR_PARTS

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 03:23:36 PDT 2023

luke added inline comments.

Comment at: llvm/test/CodeGen/RISCV/rvv/vror-sdnode.ll:2063
-; CHECK-RV32-NEXT:    vsetvli a0, zero, e64, m8, ta, ma
-; CHECK-RV32-NEXT:    vmv.v.i v16, 1
-; CHECK-RV32-NEXT:    vrsub.vi v16, v16, 0
craig.topper wrote:
> There's a missed constant fold of sub of two constant splat_vector parts here. computeKnownBits is hiding it because we constant fold it inside computeKnownBits, but we should handle it in FoldConstantArithmetic
Yeah, this was the first thing I tried. I found that there's a lot of logic that needs shared, and there's some other binop cases that aren't fully handled e.g. a bitcast of a splat_vector, or where one operand is bitcasted and the other isn't. Will give it a revisit.

Some other places I saw where I think we might need to handle splat_vector_parts:

isConstantSplatVector/isConstantSplatVectorAllOnes/isConstantSplatVectorAllZeros/isConstOrConstSplat in SelectionDAGNodes.h 
SelectionDAG::getValidShiftAmountConstant and friends
isConstantOrConstantVector in DAGCombiner

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list