[PATCH] D103334: [GISel] Eliminate redundant bitmasking

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 28 14:18:04 PDT 2021


jroelofs added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3025
+      B.buildCopy(Dst, B.buildConstant(Ty, 0));
+    }
+  };
----------------
paquette wrote:
> 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.)
👍


================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/opt-overlapping-and.ll:1
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -o - -verify-machineinstrs -global-isel=1 | FileCheck %s
----------------
paquette wrote:
> Can this be a MIR test?
👍


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