[PATCH] D129589: [Attributor] Don't crash if getAnalysisResultForFunction() returns null LoopInfo

Augie Fackler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 13:15:17 PDT 2022


durin42 created this revision.
Herald added subscribers: ormris, okura, jdoerfert, kuter, hiraditya.
Herald added a reviewer: homerdin.
Herald added a project: All.
durin42 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I have no idea what's going on here. This code was moved
around/introduced in change cb26b01d57f5 <https://reviews.llvm.org/rGcb26b01d57f50483df006af35f17167900c2dcd1> and starts crashing with a NULL
dereference once I apply https://reviews.llvm.org/D123090. I assume that
I've unwittingly taught the attributor enough that it's able to do more
clever things than in the past, and it's able to trip on this case. I
make no claims about the correctness of this patch, but it passes tests
and seems to fix all the crashes I've been seeing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129589

Files:
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp


Index: llvm/lib/Transforms/IPO/AttributorAttributes.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -6402,6 +6402,8 @@
       MayContainIrreducibleControl = mayContainIrreducibleControl(*F, LI);
     if (MayContainIrreducibleControl.value())
       return true;
+    if (!LI)
+      return false;
     return LI->getLoopFor(&BB) != nullptr;
   };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129589.444064.patch
Type: text/x-patch
Size: 482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220712/7cd013e9/attachment.bin>


More information about the llvm-commits mailing list