[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 02:41:13 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1873
+                    CurrentStoreI->getAlign() >=
+                        LoadI->getType()->getScalarSizeInBits() / 8)
+                  continue;
----------------
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.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1878
+          // This is a potentially clobbering store, but it writes the same
+          // value, so we can safely ignore it.
         }
----------------
Position of this comment doesn't look right.


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