[llvm] [CVP] Infer no-wrap flags from operand ranges at use sites. (PR #207522)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 6 02:02:36 PDT 2026
https://github.com/fhahn commented:
> Are the motivating cases predominantly one-use or multi-use?
>
For my C/C++ test set, it looks like restricting to one use covers ~60%-70% of the cases. For Swift, the multi-use cases are more common.
> I wonder if it's possible to generalize r() in this direction instead. It seems like there's two generalizations here. One is that dominating (non-phi) conditions can be used, and the other is that limited multi-use is supported. The former generlization seems like it should be simple, as it's just a matter of adjusting the context instruction in getValueAtUse().
Yep, extending `getConstantRangeAtUse` to also consider non-phi conditions should be fairly straight forward, but would probably need some gating to avoid compile-time increases. Without the restrictions in the patch, there would be a noticeable compile-time impact.
To relax the multi-use constraint, I think we would still need special logic, to compute the intersection of flags at all use sites. We could perhaps add something like `getConstantRangeAtAllUses` which returns this intersection and use that in `processBinOp` if that would be preferred?
https://github.com/llvm/llvm-project/pull/207522
More information about the llvm-commits
mailing list