[PATCH] D140411: SCCP: Don't assert on constantexpr casts of function uses

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 06:27:34 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/SCCP.cpp:348
         continue;
-      CallBase *CB = cast<CallBase>(U.getUser());
+
+      // FIXME: Could this be a ConstantExpr cast user with a use in a call site
----------------
arsenm wrote:
> fhahn wrote:
> > IIUC we only want to adjust the attributes for direct calls, and skip assume-like calls, so something like below?
> >  
> > ```
> >      if (CB->getCalledFunction() != F) {
> >         assert(cast<IntrinsicInst>(CB)->isAssumeLikeIntrinsic());
> >         continue;
> >       }
> > ```
> In principle yes, but ConstantExpr makes everything more difficult as always. The case that failed here is actually the constantexpr cast, and then you need to consider the users.
Well almost, it's really the existing isa<BlockAddress> or a dead constantexpr here. IntrinsicInst satisfies CallBase


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140411/new/

https://reviews.llvm.org/D140411



More information about the llvm-commits mailing list