This is an archive of the discontinued LLVM Phabricator instance.

[llvm][NFC] Consolidate equivalent function type parsing code into single function
ClosedPublic

Authored by leonardchan on Oct 5 2022, 11:14 AM.

Diff Detail

Event Timeline

leonardchan created this revision.Oct 5 2022, 11:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2022, 11:14 AM
leonardchan requested review of this revision.Oct 5 2022, 11:14 AM
leonardchan updated this revision to Diff 465477.
arsenm accepted this revision.Oct 5 2022, 11:31 AM
This revision is now accepted and ready to land.Oct 5 2022, 11:31 AM
This revision was landed with ongoing or failed builds.Oct 5 2022, 11:41 AM
This revision was automatically updated to reflect the committed changes.

Hi, it looks like this commit broke my compile. I did:

$ cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=ON -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON-DLLVM_CCACHE_BUILD=ON-DMLIR_INCLUDE_INTEGRATION_TESTS=ON
$ cmake --build . --target check-mlir

And I get:

FAILED: lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o 
/usr/bin/clang++ -DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/local/google/home/muralivi/llvm-project/build/lib/AsmParser -I/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser -I/usr/local/google/home/muralivi/llvm-project/build/include -I/usr/local/google/home/muralivi/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g  -fno-exceptions -fno-rtti -std=c++17 -MD -MT lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o -MF lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o.d -o lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o -c /usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:66: error: use of undeclared identifier 'ParamInfo'
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
                                                                 ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6429:20: error: use of undeclared identifier 'RetTypeLoc'
      return error(RetTypeLoc, "Invalid result type for LLVM function");
                   ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6470:7: error: no matching function for call to 'resolveFunctionType'
  if (resolveFunctionType(RetType, ArgList, Ty))
      ^~~~~~~~~~~~~~~~~~~
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:13: note: candidate function not viable: no known conversion from 'SmallVector<llvm::LLParser::ParamInfo, 16>' to 'const int' for 2nd argument
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
            ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6787:7: error: no matching function for call to 'resolveFunctionType'
  if (resolveFunctionType(RetType, ArgList, Ty))
      ^~~~~~~~~~~~~~~~~~~
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:13: note: candidate function not viable: no known conversion from 'SmallVector<llvm::LLParser::ParamInfo, 16>' to 'const int' for 2nd argument
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
            ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:7183:7: error: no matching function for call to 'resolveFunctionType'
  if (resolveFunctionType(RetType, ArgList, Ty))
      ^~~~~~~~~~~~~~~~~~~
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:13: note: candidate function not viable: no known conversion from 'SmallVector<llvm::LLParser::ParamInfo, 16>' to 'const int' for 2nd argument
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
            ^
5 errors generated.

Hi, it looks like this commit broke my compile. I did:

$ cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=ON -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON-DLLVM_CCACHE_BUILD=ON-DMLIR_INCLUDE_INTEGRATION_TESTS=ON
$ cmake --build . --target check-mlir

And I get:

FAILED: lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o 
/usr/bin/clang++ -DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/local/google/home/muralivi/llvm-project/build/lib/AsmParser -I/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser -I/usr/local/google/home/muralivi/llvm-project/build/include -I/usr/local/google/home/muralivi/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g  -fno-exceptions -fno-rtti -std=c++17 -MD -MT lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o -MF lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o.d -o lib/AsmParser/CMakeFiles/LLVMAsmParser.dir/LLParser.cpp.o -c /usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:66: error: use of undeclared identifier 'ParamInfo'
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
                                                                 ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6429:20: error: use of undeclared identifier 'RetTypeLoc'
      return error(RetTypeLoc, "Invalid result type for LLVM function");
                   ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6470:7: error: no matching function for call to 'resolveFunctionType'
  if (resolveFunctionType(RetType, ArgList, Ty))
      ^~~~~~~~~~~~~~~~~~~
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:13: note: candidate function not viable: no known conversion from 'SmallVector<llvm::LLParser::ParamInfo, 16>' to 'const int' for 2nd argument
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
            ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6787:7: error: no matching function for call to 'resolveFunctionType'
  if (resolveFunctionType(RetType, ArgList, Ty))
      ^~~~~~~~~~~~~~~~~~~
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:13: note: candidate function not viable: no known conversion from 'SmallVector<llvm::LLParser::ParamInfo, 16>' to 'const int' for 2nd argument
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
            ^
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:7183:7: error: no matching function for call to 'resolveFunctionType'
  if (resolveFunctionType(RetType, ArgList, Ty))
      ^~~~~~~~~~~~~~~~~~~
/usr/local/google/home/muralivi/llvm-project/llvm/lib/AsmParser/LLParser.cpp:6420:13: note: candidate function not viable: no known conversion from 'SmallVector<llvm::LLParser::ParamInfo, 16>' to 'const int' for 2nd argument
static bool resolveFunctionType(Type *RetType, const SmallVector<ParamInfo, 16> &ArgList, FunctionType *&FuncTy) {
            ^
5 errors generated.

Does https://reviews.llvm.org/rG34004d2d03a9a4908254ebbe5e60b6c99c9425d8 resolve this for you?