[llvm] [SeparateConstOffsetFromGEP] Preserve inbounds flag based on ValueTracking and NUW (PR #130617)

Fabian Ritter via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 02:41:47 PDT 2025


================
@@ -778,17 +780,45 @@ 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) {
----------------
ritter-x2a wrote:

I agree with adding the const (done), but I'd rather not use a reference here since that would complicate the `dyn_cast`s in the callee and the `all_of` with a `SmallVector<User*,...>` at the call site.

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


More information about the llvm-commits mailing list