[PATCH] D132657: [DSE] Eliminate noop store even through has clobbering between LoadI and StoreI

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 17 04:06:10 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1873
+                    CurrentStoreI->getAlign() >=
+                        LoadI->getType()->getScalarSizeInBits() / 8)
+                  continue;
----------------
nikic wrote:
> This should use `DL.getTypeStoreSize()`. Please add tests for these two cases: 1. Non-byte-sized types, e.g. `i12` requires `align 2` not `align 1`. 2. Pointer types, for which getScalarSizeInBits() returns zero.
Also, don't we have to check alignment on both the load and the store? If you have `load align 1, store align 4` they might still be offset.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132657



More information about the llvm-commits mailing list