[llvm] [InstCombine] If inst in unreachable refers to an inst change it to poison (#65107) (PR #78444)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 02:38:14 PST 2024


================
@@ -3231,9 +3231,8 @@ void InstCombinerImpl::handleUnreachableFrom(
     MadeIRChange = true;
   }
 
-  // RemoveDIs: to match behaviour in dbg.value mode, drop debug-info on
-  // terminator too.
-  BB->getTerminator()->dropDbgValues();
+  if (!DT.isReachableFromEntry(BB))
----------------
nikic wrote:

Your previous version here was correct. handleUnreachableFrom already guarantees that the code is unreachable. Checking isReachableFromEntry does not work as desired inside InstCombine (it does not make use of reachability knowledge private to InstCombine).

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


More information about the llvm-commits mailing list