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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 06:33:53 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);
----------------
nikic wrote:

Should work after https://github.com/llvm/llvm-project/commit/3824a2dbcefe266849b9f8b3eaa1dd23354b15de.

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


More information about the llvm-commits mailing list