[llvm] [InstCombine] Retain debug information on store to null instruction (PR #86105)

Abinaya Saravanan via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 03:07:19 PDT 2024


https://github.com/quic-asaravan created https://github.com/llvm/llvm-project/pull/86105

Call InsertNewInstWith() instead of InsertNewInstBefore() when creating "store to null" instruction

>From 4a8657baf6669ebb419e70554337b848749bba8d Mon Sep 17 00:00:00 2001
From: quic-asaravan <quic_asaravan at quicinc.com>
Date: Thu, 21 Mar 2024 03:02:18 -0700
Subject: [PATCH] [InstCombine] Retain debug information on store to null
 instruction

---
 llvm/lib/Transforms/InstCombine/InstCombineInternal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index b9ad3a74007929..c998c727eba48b 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -461,7 +461,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
     auto *SI = new StoreInst(ConstantInt::getTrue(Ctx),
                              PoisonValue::get(PointerType::getUnqual(Ctx)),
                              /*isVolatile*/ false, Align(1));
-    InsertNewInstBefore(SI, InsertAt->getIterator());
+    InsertNewInstWith(SI, InsertAt->getIterator());
   }
 
   /// Combiner aware instruction erasure.



More information about the llvm-commits mailing list