[llvm] [IR] Add nowrap flags for trunc instruction (PR #85592)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 06:26:31 PDT 2024


nikic wrote:

@elhewaty There is a lot of possible followup work here, I think some of the most important piece would be:

 * Implement inference for nuw/nsw flags in InstCombine
 * Implement zext(trunc nuw) and sext(trunc nsw) fold
 * Emit trunc nuw/nsw in SimplifyIndVars IV widening

And beyond that switching various transform to make use of the flags, for example this fold should use the flags instead of checking KnownBits: https://github.com/llvm/llvm-project/blob/3a2c70b3713a856ea416d92abdddb7893fca308b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp#L1504

https://github.com/llvm/llvm-project/pull/85592


More information about the llvm-commits mailing list