[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 13:49:25 PDT 2025


================
@@ -3362,10 +3385,23 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
     DIB.reset(new DIBuilder(*MI.getModule(), /*AllowUnresolved=*/false));
   }
 
-  if (isAllocSiteRemovable(&MI, Users, TLI)) {
+  // Determine what getInitialValueOfAllocation would return without actually allocating the result.
+  bool KnowInitUndef = isa<AllocaInst>(MI);
----------------
vtjnash wrote:

Seems like a good idea, but it doesn't look like it: https://llvm.org/doxygen/namespacellvm.html#a108b6e33f153eda5019d322f0ac909b0

https://github.com/llvm/llvm-project/pull/143958


More information about the llvm-commits mailing list