[PATCH] D77991: [llvm][NFC] CallSite removal from inliner-related files
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 12 23:57:43 PDT 2020
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SafeStack.cpp:324
case Instruction::Invoke: {
- ImmutableCallSite CS(I);
+ const InvokeInst &CS = *cast<InvokeInst>(I);
----------------
Shouldn't this be CallBase? Instruction::Call uses this code too.
================
Comment at: llvm/lib/CodeGen/SafeStack.cpp:707
-bool SafeStack::ShouldInlinePointerAddress(CallSite &CS) {
- Function *Callee = CS.getCalledFunction();
- if (CS.hasFnAttr(Attribute::AlwaysInline) &&
+bool SafeStack::ShouldInlinePointerAddress(CallBase &CB) {
+ Function *Callee = CB.getCalledFunction();
----------------
Use CallInst to match the only caller?
================
Comment at: llvm/lib/CodeGen/SafeStack.cpp:719
void SafeStack::TryInlinePointerAddress() {
- if (!isa<CallInst>(UnsafeStackPtr))
+ auto *CB = dyn_cast<CallInst>(UnsafeStackPtr);
+ if (!CB)
----------------
I think this should be CI not CB since its CallInst not CallBase.
================
Comment at: llvm/lib/Transforms/IPO/PartialInlining.cpp:310
+ return CI;
else if (InvokeInst *II = dyn_cast<InvokeInst>(U))
+ return II;
----------------
Since you're here anyway, drop the else
================
Comment at: llvm/lib/Transforms/IPO/PartialInlining.cpp:314
llvm_unreachable("All uses must be calls");
- return CS;
+ return nullptr;
}
----------------
Drop this since it should be obviously unreachable without the elses?
================
Comment at: llvm/lib/Transforms/IPO/PartialInlining.cpp:772
- Instruction *Call = CS.getInstruction();
- Function *Callee = CS.getCalledFunction();
+ Instruction *Call = &CB;
+ Function *Callee = CB.getCalledFunction();
----------------
Why do we need this variable?
================
Comment at: llvm/lib/Transforms/IPO/PartialInlining.cpp:785
assert(Call && "invalid callsite for partial inline");
InlineCost IC = getInlineCost(cast<CallBase>(*Call), getInlineParams(),
CalleeTTI, *GetAssumptionCache, GetBFI, *GetTLI,
----------------
Can we just use CB instead of *Call
================
Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1659
Function *ForwardVarArgsTo) {
- Instruction *TheCall = CS.getInstruction();
+ Instruction *const TheCall = &CB;
assert(TheCall->getParent() && TheCall->getFunction()
----------------
Drop this variable?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77991/new/
https://reviews.llvm.org/D77991
More information about the llvm-commits
mailing list