[llvm] [InstCombine] Support gep nuw in icmp folds (PR #118472)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 05:35:50 PST 2024


bgra8 wrote:

@nikic  Is it intended for this patch to optimize out the code in the `Check()` function below (just want to make sure this is intentional)? This patch removes the comparison and just returns `false`.

Thanks in advance!

```c++
using size_t = decltype(sizeof(int));

bool Check(const unsigned char* input, size_t size_input_in_bytes) {
  return (input + size_input_in_bytes < input);
}

int main() {
  unsigned char* buffer = new unsigned char[128];
  return Check(buffer, ~static_cast<size_t>(0)) ? 0 : 1;
}
```

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


More information about the llvm-commits mailing list