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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 03:01:33 PST 2022


fhahn added a comment.

Thanks for the patch!



================
Comment at: llvm/lib/Transforms/IPO/SCCP.cpp:87
+
+               if (auto *II = dyn_cast<IntrinsicInst>(U)) {
+                 if (II->isAssumeLikeIntrinsic())
----------------
It would probably be good to add a comment here explaining why we skip assume-like intrinsics here.


================
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
----------------
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;
      }
```


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

https://reviews.llvm.org/D140411



More information about the llvm-commits mailing list