[PATCH] D152691: [LICM] Sunk instructions with invalid source location.

Carlos Alberto Enciso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 04:19:24 PDT 2023


CarlosAlbertoEnciso added a comment.

@aprantl and @fdeazeve, thanks very much for your valuable feedback.



================
Comment at: llvm/lib/Transforms/Scalar/LICM.cpp:1715
         PN, &I, LI, SunkCopies, SafetyInfo, CurLoop, MSSAU);
+    New->dropLocation();
     PN->replaceAllUsesWith(New);
----------------
aprantl wrote:
> Can you add a comment here explaining that we do this because we sink the instruction out of the BB?
Added a comment.


================
Comment at: llvm/test/Transforms/LICM/sink-instruction-invalid-location.ll:39
+define dso_local noundef i32 @"?getInOrder@@YAHH at Z"(i32 noundef %Idx) local_unnamed_addr #0 !dbg !9 {
+entry:
+  %idxprom = sext i32 %Idx to i64, !dbg !14
----------------
fdeazeve wrote:
> If I understand correctly, the contents of this function are not needed by the test and could be replaced by a `ret i32 2`
> 
> Note this will also make the other GV unused.
You are correct. Replaced by `ret i32 2`.


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

https://reviews.llvm.org/D152691



More information about the llvm-commits mailing list