This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Simplify various pieces of code now that Identifier has access to the Context/Dialect
ClosedPublic

Authored by rriddle on Feb 24 2021, 5:49 PM.

Details

Summary

This also exposed a bug in Dialect loading where it was not correctly identifying identifiers that had the dialect namespace as a prefix.

Diff Detail

Event Timeline

rriddle created this revision.Feb 24 2021, 5:49 PM
rriddle requested review of this revision.Feb 24 2021, 5:49 PM
mehdi_amini accepted this revision.Feb 24 2021, 6:54 PM
This revision is now accepted and ready to land.Feb 24 2021, 6:54 PM
This revision was landed with ongoing or failed builds.Feb 26 2021, 6:10 PM
This revision was automatically updated to reflect the committed changes.

This patch introduces a build error according to my bisect:

$ git bisect log
# bad: [bf4dbc49843ca24e90e37f127ceef988286cd1c6] [flang][f18] Add missing line in help text (nfc)
# good: [c218c80c730a14a1cbcebd588b18220a879702c6] [libcxx] [test] Quote the path to the python interpreter
git bisect start 'bf4dbc49843ca24e90e37f127ceef988286cd1c6' 'c218c80c730a14a1cbcebd588b18220a879702c6'
# bad: [302cc8421ee4ac1cf910dd6cd3306c6eae8d0d3e] [clang-tidy] Simplify boolean expr check
git bisect bad 302cc8421ee4ac1cf910dd6cd3306c6eae8d0d3e
# good: [c90dac27e94ec354a3e8919556ac5bc89b62c731] [clang] Print 32 candidates on the first failure, with -fshow-overloads=best.
git bisect good c90dac27e94ec354a3e8919556ac5bc89b62c731
# good: [e4dd614ae81194b0a50361a91f8bd4364916ef2e] [libcxx] cleans up __cpp_concepts mess
git bisect good e4dd614ae81194b0a50361a91f8bd4364916ef2e
# good: [5077d42cfa427598826eb7b69ad805bad8f4ec9d] [flang][fir][NFC] Removes deprecated messages in builds.
git bisect good 5077d42cfa427598826eb7b69ad805bad8f4ec9d
# good: [9e0d55024d4ed776f209ee04e260bdd314854993] [clang][NFC] Clean up whitespace in ClangOpcodesEmitter output
git bisect good 9e0d55024d4ed776f209ee04e260bdd314854993
# bad: [df6fb4d392e530fbf9d4e331711c500d47980dcc] [llvm] Add assertions for the smart pointers with the possibility to be null in DWARFLinker::loadClangModule
git bisect bad df6fb4d392e530fbf9d4e331711c500d47980dcc
# bad: [2e2ee4300d1f9766209d435c0d8c44c72092b974] [test] Add -triple x86_64 to attr-retain.cpp
git bisect bad 2e2ee4300d1f9766209d435c0d8c44c72092b974
# bad: [e6260ad043d84c54d10e463dd82de829c1be24f7] [mlir] Simplify various pieces of code now that Identifier has access to the Context/Dialect
git bisect bad e6260ad043d84c54d10e463dd82de829c1be24f7
# good: [16abacaea9db653b41808fc37277b68168438059] [MLIR][TOSA] Resubmit Tosa to Standard/SCF Lowerings (const, if, while)"
git bisect good 16abacaea9db653b41808fc37277b68168438059
# first bad commit: [e6260ad043d84c54d10e463dd82de829c1be24f7] [mlir] Simplify various pieces of code now that Identifier has access to the Context/Dialect

$ mkdir -p build

$ cd build

$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=all ../llvm

$ ninja projects/debuginfo-tests/CMakeFiles/check-gdb-mlir-support.dir/llvm-prettyprinters/gdb/mlir-support.cpp.o
/home/nathan/src/llvm-project/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp:29:55: error: no matching function for call to ‘mlir::NameLoc::get(mlir::Identifier&, mlir::MLIRContext*)’
   29 | auto NameLoc = mlir::NameLoc::get(Identifier, &Context);
      |                                                       ^
In file included from /home/nathan/src/llvm-project/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp:4:
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:173:19: note: candidate: ‘static mlir::Location mlir::NameLoc::get(mlir::Identifier, mlir::Location)’
  173 |   static Location get(Identifier name, Location child);
      |                   ^~~
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:173:49: note:   no known conversion for argument 2 from ‘mlir::MLIRContext*’ to ‘mlir::Location’
  173 |   static Location get(Identifier name, Location child);
      |                                        ~~~~~~~~~^~~~~
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:176:19: note: candidate: ‘static mlir::Location mlir::NameLoc::get(mlir::Identifier)’
  176 |   static Location get(Identifier name);
      |                   ^~~
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:176:19: note:   candidate expects 1 argument, 2 provided
/home/nathan/src/llvm-project/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp:31:72: error: no matching function for call to ‘mlir::FusedLoc::get(<brace-enclosed initializer list>, mlir::MLIRContext*)’
   31 | auto FusedLoc = mlir::FusedLoc::get({FileLineColLoc, NameLoc}, &Context);
      |                                                                        ^
In file included from /home/nathan/src/llvm-project/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp:4:
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:152:19: note: candidate: ‘static mlir::Location mlir::FusedLoc::get(llvm::ArrayRef<mlir::Location>, mlir::Attribute, mlir::MLIRContext*)’
  152 |   static Location get(ArrayRef<Location> locs, Attribute metadata,
      |                   ^~~
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:152:19: note:   candidate expects 3 arguments, 2 provided
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:154:19: note: candidate: ‘static mlir::Location mlir::FusedLoc::get(llvm::ArrayRef<mlir::Location>, mlir::MLIRContext*)’
  154 |   static Location get(ArrayRef<Location> locs, MLIRContext *context) {
      |                   ^~~
/home/nathan/src/llvm-project/llvm/../mlir/include/mlir/IR/Location.h:154:42: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘llvm::ArrayRef<mlir::Location>’
  154 |   static Location get(ArrayRef<Location> locs, MLIRContext *context) {
      |                       ~~~~~~~~~~~~~~~~~~~^~~~
ninja: build stopped: subcommand failed.

Presumably the &Context should be removed but I am not sure, hence just the report.