[PATCH] D139213: Make NVVM Reflect pass look inside ptr casting
Hugh Delaney via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 2 10:42:13 PST 2022
hdelan created this revision.
Herald added subscribers: mattd, gchakrabarti, asavonic, hiraditya.
Herald added a project: All.
hdelan requested review of this revision.
Herald added subscribers: llvm-commits, jholewinski.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139213
Files:
llvm/include/llvm/IR/InstrTypes.h
llvm/lib/Target/NVPTX/NVVMReflect.cpp
Index: llvm/lib/Target/NVPTX/NVVMReflect.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVVMReflect.cpp
+++ llvm/lib/Target/NVPTX/NVVMReflect.cpp
@@ -118,6 +118,8 @@
if (!Call)
continue;
Function *Callee = Call->getCalledFunction();
+ if (!Callee)
+ Callee = Call->getCalledFunctionRemovingPtrCasts();
if (!Callee || (Callee->getName() != NVVM_REFLECT_FUNCTION &&
Callee->getIntrinsicID() != Intrinsic::nvvm_reflect))
continue;
Index: llvm/include/llvm/IR/InstrTypes.h
===================================================================
--- llvm/include/llvm/IR/InstrTypes.h
+++ llvm/include/llvm/IR/InstrTypes.h
@@ -1401,6 +1401,13 @@
return nullptr;
}
+ /// Returns the function called and removes the pointer casting around it
+ Function *getCalledFunctionRemovingPtrCasts() const {
+ if (auto *Operand = getCalledOperand())
+ return dyn_cast_or_null<Function>(Operand->stripPointerCasts());
+ return nullptr;
+ }
+
/// Return true if the callsite is an indirect call.
bool isIndirectCall() const;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139213.479675.patch
Type: text/x-patch
Size: 1142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221202/d7831d97/attachment.bin>
More information about the llvm-commits
mailing list