This is an archive of the discontinued LLVM Phabricator instance.

[Builder] Eliminate Builder::getSymbolRefAttr methods.
ClosedPublic

Authored by lattner on Aug 30 2021, 9:31 AM.

Details

Summary

The StringAttr version doesn't need a context, so we can just use the
existing SymbolRefAttr::get form. The StringRef version isn't preferred
so we want to encourage people to use StringAttr. The Operation* version
also doesn't need a context, so it can just move over to SymbolRefAttr to
make the family be consistent.

Diff Detail

Event Timeline

lattner created this revision.Aug 30 2021, 9:31 AM
lattner requested review of this revision.Aug 30 2021, 9:31 AM
lattner updated this revision to Diff 369483.Aug 30 2021, 10:20 AM

Update the examples as well.

The build status on this revision is broken FYI (in case you didn't notice), it seems that both Toy and Flang need an update.

(for Toy you missed chapter 7 I think)

lattner updated this revision to Diff 369502.Aug 30 2021, 11:28 AM

Eliminate the Symbol operation forms of getSymbolRefAttr, moving them over to SymbolRefAttr::get also. Update Ch7 of examples and flang as well.

This keeps all the builders more consistent.

lattner updated this revision to Diff 369504.Aug 30 2021, 11:30 AM
lattner retitled this revision from [Builder] Eliminate the StringRef/StringAttr forms of getSymbolRefAttr. to [Builder] Eliminate Builder::getSymbolRefAttr methods..
lattner edited the summary of this revision. (Show Details)

update commit message.

I am not 100% sure what the "patch application failed" means, but perhaps you can rebase so we get a build bot result before submitting just to make sure we are green?

Sure, happy to. I'm not sure what the problem is here, but it doesn't look related, I'll rebase:

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.')
ERROR   exception: Cmd('git') failed due to: exit code(128)
  cmdline: git reset --hard
  stderr: 'fatal: Unable to create '/var/lib/buildkite-agent/builds/llvm-project-fork/.git/index.lock': File exists.

Sure, happy to. I'm not sure what the problem is here, but it doesn't look related, I'll rebase:

Thanks! I have seen the "patch application failed" a few times myself, and always rebased assuming it was some conflict.
But perhaps it is even simpler than that ;-)

rriddle accepted this revision.Aug 30 2021, 12:15 PM
rriddle added inline comments.
flang/include/flang/Optimizer/Dialect/FIROps.td
2564–2565
This revision is now accepted and ready to land.Aug 30 2021, 12:15 PM

Still some ch7 and flang issues, am I reading the report logs right?

FYI, the bot sees still an issue with Toy:

/var/lib/buildkite-agent/builds/llvm-project/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp:525:9: error: use of undeclared identifier 'SymbolRefAttr'; did you mean 'mlir::SymbolRefAttr'?
        SymbolRefAttr::get(builder.getContext(), callee), operands);
        ^~~~~~~~~~~~~
        mlir::SymbolRefAttr
lattner updated this revision to Diff 369552.Aug 30 2021, 2:30 PM

Fix build problems with examples. I actually built them and ran the example
tests this time, yay.

There may still be problems with Fortran, I will not push this until they
get settled of course.