[llvm] [InstCombine] Don't consider aligned_alloc removable if icmp uses result (PR #69474)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 08:45:03 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) {
----------------
fhahn wrote:

Not really, removed them

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


More information about the llvm-commits mailing list