[llvm] [SeparateConstOffsetFromGEP] Preserve inbounds flag based on ValueTracking and NUW (PR #130617)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 13 01:35:11 PDT 2025
================
@@ -811,6 +780,30 @@ Value *ConstantOffsetExtractor::removeConstOffset(unsigned ChainIndex) {
return NewBO;
}
+/// A helper function to check if reassociating through an entry in the user
+/// chain would invalidate the GEP's nuw flag.
+static bool allowsPreservingNUW(User *U) {
+ assert(isa<BinaryOperator>(U) || isa<CastInst>(U) || isa<ConstantInt>(U));
----------------
arsenm wrote:
ConstantInt being a User is a wart, but that doesn't imply that constantInt can use an operator
https://github.com/llvm/llvm-project/pull/130617
More information about the llvm-commits
mailing list