[PATCH] D109888: Bitcast wrapped in a call obscures function attributes, pessimizing MemorySSA

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 16 10:49:50 PDT 2021


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

In D109888#3004336 <https://reviews.llvm.org/D109888#3004336>, @jdoerfert wrote:

> LGTM, anyone else?

LG



================
Comment at: llvm/lib/IR/Instructions.cpp:353-354
+  Value *V = getCalledOperand();
+  if (auto *CE = dyn_cast<ConstantExpr>(V))
+    if (CE->getOpcode() == BitCast)
+      V = CE->getOperand(0);
----------------
There's `BitCastOperator`, but it would also catch instructions


================
Comment at: llvm/lib/IR/Instructions.cpp:357-358
+
+  if (isa<Function>(V))
+    return cast<Function>(V)->getAttributes().hasFnAttr(Kind);
+
----------------
Could also use `dyn_cast`, don't know if that would be better/worse.


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

https://reviews.llvm.org/D109888



More information about the llvm-commits mailing list