[llvm] Skip negative length while inferring initializes attr (PR #120874)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 00:45:13 PST 2024


================
@@ -633,10 +633,13 @@ ArgumentAccessInfo getArgmentAccessInfo(const Instruction *I,
       [](Value *Length,
          std::optional<int64_t> Offset) -> std::optional<ConstantRange> {
     auto *ConstantLength = dyn_cast<ConstantInt>(Length);
-    if (ConstantLength && Offset)
+    if (ConstantLength && Offset) {
----------------
nikic wrote:

Include in the if condition?
```suggestion
    if (ConstantLength && Offset && ConstantLength->isNonNegative()) {
```

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


More information about the llvm-commits mailing list