[PATCH] D103334: [GISel] Eliminate redundant bitmasking

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 13:26:38 PDT 2021


paquette added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3025
+      B.buildCopy(Dst, B.buildConstant(Ty, 0));
+    }
+  };
----------------
jroelofs wrote:
> paquette wrote:
> > Minor stylistic suggestion:
> > 
> > ```
> > if (C1 & C2) {
> >   B.buildAnd(...);
> >   return;
> > }
> > 
> > B.buildCopy(...);
> > ```
> > 
> > Is it actually necessary to emit the copy at all though? You could do
> > 
> > ```
> > Dst = G_CONSTANT iN 0
> > ```
> > 
> > right?
> Are we guaranteed that `Dst` is not a physical register? I wasn't sure.
With G_AND (and other generic opcodes) we can be certain that we only have vregs.

(You have to be careful with COPY instructions, but in this case, we don't have to worry.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103334



More information about the llvm-commits mailing list