[PATCH] D151945: Introduce G_OPAQUE and use it to prevent constant folding hoisted constants.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 00:13:47 PDT 2023


aemerson added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp:1475
+    // ConstantHoisting and we should leave it alone.
+    if (isa<ConstantInt>(U.getOperand(0)))
+      return translateCast(TargetOpcode::G_OPAQUE, U, MIRBuilder);
----------------
tschuett wrote:
> I would have expected the size to be part of the heuristic. Why G_OPAQUE an i1?
There's no heuristic here. The heuristics are used in ConstantHoisting which uses NOP bitcasts hide constants. Here we're just recognizing those nop bitcasts and using G_OPAQUE accordingly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151945



More information about the llvm-commits mailing list