Fold (srl (mul (zext i32:$a to i64), i64:c), 32) -> (mulhu $a, $b) if c can truncate to i32 without loss.
I'm adding some non-RVV reviewers in this field; that may help move this patch along.
I think the way HasConstant is interacting with checks below this could do with explanation (in the code). It's not clear to me why and how it interacts with logic later in this function.
I might be narrowly-focussed here, but I'm not sure why we need a ternary here. Can't we capture RightOp.getOperand(0) in a variable and ensure it's correct in the the if (HasConstant) block? Would that simplify any of the other logic?
Do we need to worry about Constant LHS? Won't the mul be canonicalized and then the shift will be revisited?
Isn't ActiveBits the wrong thing to check for SIGN_EXTEND?
Was this test case supposed to match to mulh?