[PATCH] D84220: [IPSCCP] Fix a bug that the "returned" attribute is not cleared when function is optimized to return undef

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 10:46:49 PDT 2020


congzhe added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:37
 #include "llvm/Analysis/ValueLatticeUtils.h"
+#include "llvm/IR/AbstractCallSite.h"
 #include "llvm/IR/BasicBlock.h"
----------------
fhahn wrote:
> Is this include needed?
This header file is included since we need the `CallBase` class when we remove the `returned` attribute in call sites.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:2057
+	continue;
+      CallBase *CB = dyn_cast<CallBase>(U.getUser());
+      assert(CB && "Use of zapped functions should be valid direct calls!");
----------------
fhahn wrote:
> I think you can just use `cast<>` here, which has a similar assertion.
Thanks. Now used `cast<>` instead of `dyn_cast<>` and removed the `assert()`.


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

https://reviews.llvm.org/D84220



More information about the llvm-commits mailing list