[llvm] [LLVM][InstCombine] Enable constant folding for SVE asr,lsl and lsr intrinsics. (PR #137350)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 28 06:54:23 PDT 2025
================
@@ -1571,7 +1583,11 @@ simplifySVEIntrinsicBinOp(InstCombiner &IC, IntrinsicInst &II,
else
SimpleII = simplifyBinOp(Opc, Op1, Op2, DL);
- if (!SimpleII)
+ // An SVE intrinsic's result is always defined. However, this is not the case
+ // for its equivalent IR instruction (e.g. when shifting by an amount more
+ // than the data's bitwidth). Simplifications to an undefined result must be
+ // ignored to preserve the intrinsic's expected behaviour.
+ if (!SimpleII || isa<UndefValue>(SimpleII))
----------------
paulwalker-arm wrote:
I talk to this in the commit message. At this stage we've not encountered any legitimate reasons to propagate poison so they are ignored to reduce complexity. As there was no intent to propagate poison from my original code there are no tests that rely on it. Which is the other reason it seemed reasonable to make the switch.
I believe `isa<UndefValue>(X)` returns true for both `undef` and `poison` because they are both types of undefined values.
https://github.com/llvm/llvm-project/pull/137350
More information about the llvm-commits
mailing list