[PATCH] D68342: [Analysis] Don't assume that overflow can't happen in EmitGEPOffset

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 10:15:43 PDT 2019


lebedev.ri added a comment.

I'm not fully convinced this is correct, as per
https://llvm.org/docs/LangRef.html#getelementptr-instruction

  If the inbounds keyword is present, the result value of the getelementptr is a poison value
  if the base pointer is not an in bounds address of an allocated object, or if any of the
  addresses that would be formed by successive addition of the offsets implied by the indices
  to the base address with infinitely precise signed arithmetic are not an in bounds address
  of that allocated object. <...>
  
  If the inbounds keyword is not present, the offsets are added to the base address with
  silently-wrapping two’s complement arithmetic.

At worst `NUW` should be relaxed to `NSW`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68342





More information about the llvm-commits mailing list