[all-commits] [llvm/llvm-project] 0af5c0: [InstCombine] Don't consider aligned_alloc removab...

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Oct 19 10:35:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0af5c0668a1b93c7b3b34a1885b494c4ebb0b46f
      https://github.com/llvm/llvm-project/commit/0af5c0668a1b93c7b3b34a1885b494c4ebb0b46f
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-10-19 (Thu, 19 Oct 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/malloc-free.ll

  Log Message:
  -----------
  [InstCombine] Don't consider aligned_alloc removable if icmp uses result (#69474)

At the moment, all alloc-like functions are assumed to return non-null
pointers, if their return value is only used in a compare. This is based
on being allowed to substitute the allocation function with one that
doesn't fail to allocate the required memory.

aligned_alloc however must also return null if the required alignment
cannot be satisfied, so I don't think the same reasoning as above can be
applied to it.

This patch adds a bail-out for aligned_alloc calls to
isAllocSiteRemovable.




More information about the All-commits mailing list