[llvm] [LLVM][OpenMPOpt] Fix a crash when associated function is nullptr (PR #66274)

Jan Patrick Lehr via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 14:54:16 PDT 2023


================
@@ -5028,7 +5028,9 @@ struct AAKernelInfoCallSite : AAKernelInfo {
     const auto *AACE =
         A.getAAFor<AACallEdges>(*this, getIRPosition(), DepClassTy::OPTIONAL);
     if (!AACE || !AACE->getState().isValidState() || AACE->hasUnknownCallee()) {
-      CheckCallee(getAssociatedFunction(), /*NumCallees=*/1);
+      Function *F = getAssociatedFunction();
+      if (F)
----------------
jplehr wrote:

Is there a specific reason to not reuse F in the call to `ChackCallee`?

```
if (Function *F = getAssociatedFunction())
  CheckCallee(F, 1);
```

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


More information about the llvm-commits mailing list