[llvm] 6e040a1 - [NFC] Wisely nest dyn_cast in FunctionLoweringInfo
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 16 02:22:55 PDT 2021
Author: serge-sans-paille
Date: 2021-03-16T10:22:44+01:00
New Revision: 6e040a19dbb20b28ba97374f7eb50e1ff266b15e
URL: https://github.com/llvm/llvm-project/commit/6e040a19dbb20b28ba97374f7eb50e1ff266b15e
DIFF: https://github.com/llvm/llvm-project/commit/6e040a19dbb20b28ba97374f7eb50e1ff266b15e.diff
LOG: [NFC] Wisely nest dyn_cast in FunctionLoweringInfo
Take advantage of the inheritance tree to avoid a few comparison.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index cc931df5c75c..85c6eca5775e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -192,10 +192,8 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
MF->getFrameInfo().CreateVariableSizedObject(
Alignment <= StackAlign ? Align(1) : Alignment, AI);
}
- }
-
- // Look for inline asm that clobbers the SP register.
- if (auto *Call = dyn_cast<CallBase>(&I)) {
+ } else if (auto *Call = dyn_cast<CallBase>(&I)) {
+ // Look for inline asm that clobbers the SP register.
if (Call->isInlineAsm()) {
Register SP = TLI->getStackPointerRegisterToSaveRestore();
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
@@ -214,21 +212,20 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
}
}
}
- }
-
- // Look for calls to the @llvm.va_start intrinsic. We can omit some
- // prologue boilerplate for variadic functions that don't examine their
- // arguments.
- if (const auto *II = dyn_cast<IntrinsicInst>(&I)) {
- if (II->getIntrinsicID() == Intrinsic::vastart)
- MF->getFrameInfo().setHasVAStart(true);
- }
+ // Look for calls to the @llvm.va_start intrinsic. We can omit some
+ // prologue boilerplate for variadic functions that don't examine their
+ // arguments.
+ if (const auto *II = dyn_cast<IntrinsicInst>(&I)) {
+ if (II->getIntrinsicID() == Intrinsic::vastart)
+ MF->getFrameInfo().setHasVAStart(true);
+ }
- // If we have a musttail call in a variadic function, we need to ensure we
- // forward implicit register parameters.
- if (const auto *CI = dyn_cast<CallInst>(&I)) {
- if (CI->isMustTailCall() && Fn->isVarArg())
- MF->getFrameInfo().setHasMustTailInVarArgFunc(true);
+ // If we have a musttail call in a variadic function, we need to ensure
+ // we forward implicit register parameters.
+ if (const auto *CI = dyn_cast<CallInst>(&I)) {
+ if (CI->isMustTailCall() && Fn->isVarArg())
+ MF->getFrameInfo().setHasMustTailInVarArgFunc(true);
+ }
}
// Mark values used outside their block as exported, by allocating
More information about the llvm-commits
mailing list