[llvm] [InstCombine] Don't consider aligned_alloc removable if icmp uses result (PR #69474)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 19 07:39:42 PDT 2023
================
@@ -2430,6 +2430,30 @@ static bool isAllocSiteRemovable(Instruction *AI,
unsigned OtherIndex = (ICI->getOperand(0) == PI) ? 1 : 0;
if (!isNeverEqualToUnescapedAlloc(ICI->getOperand(OtherIndex), TLI, AI))
return false;
+ // Do not fold compares to aligned_alloc calls, as they may have to
+ // return null in case the required alignment cannot be satisfied,
+ // unless we can prove that both alignment and size are valid.
+ if ((getAllocFnKind(AI) & AllocFnKind::Aligned) !=
+ AllocFnKind::Unknown) {
----------------
nikic wrote:
Do we still need this check if we're also checking TLI? (Move the TLI check up here?)
https://github.com/llvm/llvm-project/pull/69474
More information about the llvm-commits
mailing list