[all-commits] [llvm/llvm-project] 75a3f3: [IR] Add an ImplicitLocOpBuilder helper class for ...

Chris Lattner via All-commits all-commits at lists.llvm.org
Tue Dec 22 14:47:55 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75a3f326c3d874853031d8bedd1d00127c835103
      https://github.com/llvm/llvm-project/commit/75a3f326c3d874853031d8bedd1d00127c835103
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2020-12-22 (Tue, 22 Dec 2020)

  Changed paths:
    A mlir/include/mlir/IR/ImplicitLocOpBuilder.h
    M mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp

  Log Message:
  -----------
  [IR] Add an ImplicitLocOpBuilder helper class for building IR with the same loc.

One common situation is to create a lot of IR at a well known location,
e.g. when doing a big rewrite from one dialect to another where you're expanding
ops out into lots of other ops.

For these sorts of situations, it is annoying to pass the location into
every create call.  As we discused in a few threads on the forum, a way to help
with this is to produce a new sort of builder that holds a location and provides
it to each of the create<> calls automatically.

This patch implements an ImplicitLocOpBuilder class that does this.  We've had
good experience with this in the CIRCT project, and it makes sense to upstream to
MLIR.

I picked a random pass to adopt it to show the impact, but I don't think there is
any particular need to force adopt it in the codebase.

Differential Revision: https://reviews.llvm.org/D93717




More information about the All-commits mailing list