[llvm] [ArgPromotion] Consider InvokeInst in Caller alias analysis (PR #110335)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 28 00:26:49 PDT 2024


================
@@ -491,10 +491,8 @@ static bool isArgUnmodifiedByAllCalls(Argument *Arg,
                                       FunctionAnalysisManager &FAM) {
   for (User *U : Arg->getParent()->users()) {
 
-    // Bail if we find an unexpected (non CallInst) use of the function.
-    auto *Call = dyn_cast<CallInst>(U);
-    if (!Call)
-      return false;
+    assert(isa<CallBase>(U) && "Expected all users of Function to be CallBase");
+    CallBase *Call = cast<CallBase>(U);
----------------
nikic wrote:

```suggestion
    auto *Call = cast<CallBase>(U);
```
`cast` performs an implicit `isa` assert.

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


More information about the llvm-commits mailing list