[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:41 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))
----------------
nikic wrote:

I was going to say that the new checks should be in the  `isa<ConstantPointerNull>` path of isNeverEqualToUnescapedAlloc(), but on further consideration, they also apply to the other two cases (e.g. you could compare the result of two required-to-be-null aligned_allocs), so current code structure is good.

https://github.com/llvm/llvm-project/pull/69474


More information about the llvm-commits mailing list