[PATCH] D103334: [GISel] Eliminate redundant bitmasking

Jon Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 15:04:21 PDT 2021


jroelofs added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:3022
+    auto Zero = B.buildConstant(Ty, 0);
+    replaceRegWith(MRI, Dst, Zero->getOperand(0).getReg());
+  };
----------------
paquette wrote:
> I think you can just do
> 
> ```
> B.buildConstant(Dst, 0);
> ```
> 
> and omit the `replaceRegWith` (similar to the `buildAnd` case above.)
When I tried it that way, it wasn't RAUW-ing `Dst` appropriately, and then the verifier complains:

```
*** Bad machine code: Reading virtual register without a def ***
- function:    bitmask_no_overlap
- basic block: %bb.0  (0x7fe69b06d6c8)
- instruction: $w0 = COPY %4:_(s32)
- operand 1:   %4:_
```


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