[llvm] [AMDGPU] Recover direct callees from called globals (PR #192199)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 08:19:31 PDT 2026
================
@@ -59,6 +59,21 @@ static const Function *getCalleeFunction(const MachineOperand &Op) {
return cast<Function>(Op.getGlobal()->stripPointerCastsAndAliases());
}
+static const Function *getCalleeFunction(const MachineFunction &MF,
+ const MachineInstr &MI,
+ const SIInstrInfo &TII) {
+ if (MachineFunction::CalledGlobalInfo CGI = MF.tryGetCalledGlobal(&MI);
----------------
shiltian wrote:
IMHO, this conditional statement's readability is not really good. I'd just write it as something like:
```
MachineFunction::CalledGlobalInfo CGI = MF.tryGetCalledGlobal(&MI);
if (CGI.Callee) {
if (const auto *F = dyn_cast<Function>(CGI.Callee->stripPointerCastsAndAliases()))
return F;
}
...
```
https://github.com/llvm/llvm-project/pull/192199
More information about the llvm-commits
mailing list