[PATCH] D150179: [GlobalISel] Hide hoisted constants behind G_BITCAST to prevent folding.

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 02:42:51 PDT 2023


Pierre-vh added a comment.

Just wondering: if we have to add some "special" bitcast that needs to be removed before ISel anyway (+ relax G_BITCAST check rules on top of it), couldn't we just add a dedicated opcode instead?
I'm thinking of something like a `G_OPAQUE` opcode that serves as an optimization hint that an instruction should be considered opaque and no combiner should attempt to see through it. It could just be removed right before ISel.

I'm wondering if we'll see more use cases for this "hack" later and eventually end up with a use-case that cannot use G_BITCAST (e.g. pointer type?), so we end up doing a similar hack but on another opcode for a different type, etc

For instance, a `G_OPAQUE` instruction like that could be used to prevent infinite combine loop between the target-independent and target combine rules. If the target combine wants to create a pattern that isn't considered optimal by the generic combiner, it could use that opaque instruction to prevent further optimizations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150179/new/

https://reviews.llvm.org/D150179



More information about the llvm-commits mailing list