[PATCH] D104409: GlobalISel/Utils: Refactor integer/float constant match functions
Petar Avramovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 04:43:29 PDT 2021
Petar.Avramovic added a comment.
> What is the motivation behind adding G to the function names?
GlobalISel does not mention IConstant it is just G_CONSTANT but has FConstant (G_FCONSTANT). It thought that GCst in name associates better with G_CONSTANT instruction (which we know to be integer constant). Matchers use this naming style m_GAdd - integer add vs m_GFAdd - float.
Only Constant is ambiguous and is good name for generic helper function.
================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:301
+
+ while ((MI = MRI.getVRegDef(VReg)) && !isConstantOpcode(MI) &&
LookThroughInstrs) {
----------------
This guards nullptr from entering into isGConstant and other opcodes checks.
================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:328
}
- if (!MI || !IsConstantOpcode(MI->getOpcode()))
+ if (!MI || !isConstantOpcode(MI))
return None;
----------------
No nullptrs here either.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104409/new/
https://reviews.llvm.org/D104409
More information about the llvm-commits
mailing list