[all-commits] [llvm/llvm-project] fabe91: [SimplifyLibCalls] Use inbounds GEP

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jul 1 05:32:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fabe915705472e2c06ed1aa9a90620462594e82f
      https://github.com/llvm/llvm-project/commit/fabe915705472e2c06ed1aa9a90620462594e82f
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-07-01 (Fri, 01 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    M llvm/test/Transforms/InstCombine/memrchr-4.ll
    M llvm/test/Transforms/InstCombine/memset_chk-1.ll
    M llvm/test/Transforms/InstCombine/snprintf.ll
    M llvm/test/Transforms/InstCombine/sprintf-1.ll
    M llvm/test/Transforms/InstCombine/strchr-1.ll
    M llvm/test/Transforms/InstCombine/strncat-2.ll

  Log Message:
  -----------
  [SimplifyLibCalls] Use inbounds GEP

When converting strchr(p, '\0') to p + strlen(p) we know that
strlen() must return an offset that is inbounds of the allocated
object (otherwise it would be UB), so we can use an inbounds GEP.
An equivalent argument can be made for the other cases.




More information about the All-commits mailing list