[PATCH] D114035: [DSE] Improve handling of `strncpy` in Dead Store Elimination

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 18 04:28:13 PST 2021


fhahn added a comment.

Is there a way to add the right attributes to `strncpy` to avoid needing to special case it in DSE?



================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:250
+      }
+    }
+  }
----------------
Are we missing a `return MemoryLocation::getAfter(CB->getArgOperand(0))` here to preserve the existing behavior if `*CB` is not a libfunc (or not available)? 


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:1441
+          isReadClobber(KillingLoc, CurrentI)) {
+        if (const auto *CB = dyn_cast<CallBase>(CurrentI)) {
+          LibFunc LF;
----------------
having this logic here makes the code harder to read. Can this be moved to `isReadClobber`? Or into `BasicAAResult::getModRefInfo` directly?


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

https://reviews.llvm.org/D114035



More information about the llvm-commits mailing list