[all-commits] [llvm/llvm-project] f8c1a2: [llvm] Improve llvm.objectsize computation by comp...

serge-sans-paille via All-commits all-commits at lists.llvm.org
Mon Dec 9 22:28:24 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f8c1a22220345dc85bf700c8a8ca6a28839edabb
      https://github.com/llvm/llvm-project/commit/f8c1a22220345dc85bf700c8a8ca6a28839edabb
  Author: serge-sans-paille <sguelton at mozilla.com>
  Date:   2024-12-10 (Tue, 10 Dec 2024)

  Changed paths:
    M llvm/include/llvm/IR/Value.h
    M llvm/lib/Analysis/MemoryBuiltins.cpp
    A llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-range.ll

  Log Message:
  -----------
  [llvm] Improve llvm.objectsize computation by computing GEP, alloca a… (#117849)

…nd malloc parameters bound

Using a naive expression walker, it is possible to compute valuable
information for allocation functions, GEP and alloca, even in the
presence of some dynamic information.

We don't rely on computeConstantRange to avoid taking advantage of
undefined behavior, which would be counter-productive wrt. usual
llvm.objectsize usage.

llvm.objectsize plays an important role in _FORTIFY_SOURCE definitions,
so improving its diagnostic in turns improves the security of compiled
application.

As a side note, as a result of recent optimization improvements, clang
no longer passes
https://github.com/serge-sans-paille/builtin_object_size-test-suite This
commit restores the situation and greatly improves the scope of code
handled by the static version of __builtin_object_size.

This is a recommit of https://github.com/llvm/llvm-project/pull/115522
with fix applied.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list