[llvm] [DAGCombiner] Fold min/max vscale, C -> C (PR #174708)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 9 01:22:43 PST 2026
================
@@ -6253,6 +6243,34 @@ SDValue DAGCombiner::visitIMINMAX(SDNode *N) {
SDLoc(N), VT, N0, N1))
return SD;
+ // Fold operation with vscale operands.
+ if (N0.getOpcode() == ISD::VSCALE && N1.getOpcode() == ISD::VSCALE) {
----------------
lukel97 wrote:
Also separately, I ran into the issue where I think the vscale SelectionDAG node can wrap with its scale operand. I.e if we don't apply vscale_range in the tests, this combine doesn't kick in because the vscale node can overflow to zero.
This vscale is generated from a TypeSize which IIUC can't overflow 64 bits? Maybe we need a nuw flag for vscale so we don't lose this information, or instead explicitly expand it out to a `mul nuw N, (vscale 1)`
https://github.com/llvm/llvm-project/pull/174708
More information about the llvm-commits
mailing list