[PATCH] D116276: [IndVarS] Keep the nsw/nuw flags after simplifyAndExtend

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 29 09:55:40 PST 2021


nikic added a comment.

@guopeilin This doesn't really answer my question. You say that the SCEV for the wide IV at this point is `{((sext i32 %arg1 to i64) + (sext i32 %arg2 to i64)),+,(sext i32 %arg2 to i64)}<nsw><%body>`, which has the `<nsw>` flag. My baseline expectation would be that SCEVExpander will also add the nsw flag to the expanded IR (see the code around https://github.com/llvm/llvm-project/blob/015ff729cb90317e4e75cf48b1e5dd7850f0cbd0/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp#L1300-L1304). My question is why that doesn't happen, because making sure SCEVExpander propagates the flag from SCEV to IR seems like the more principled way to address this problem.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116276/new/

https://reviews.llvm.org/D116276



More information about the llvm-commits mailing list