[llvm] Add debug location to strlen in LoopIdiomRecognize pass (PR #140164)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 14:24:26 PDT 2025


================
@@ -612,3 +612,52 @@ while.end:
   ret i64 %sub.ptr.sub
 }
 
+define i64 @valid_basic_strlen_with_dbg(ptr %str) {
+; Make sure that the call to strlen has debug info attached.
+; CHECK-LABEL: define i64 @valid_basic_strlen_with_dbg(
+; CHECK-SAME: ptr [[STR:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*]]:
+; CHECK-NEXT:    [[STRLEN:%.*]] = call i64 @strlen(ptr [[STR]]), !dbg !4
----------------
dwblaikie wrote:

The metadata numbering might not remain the same across the optimization, I think? - so might be worth matching the !dbg metadata number, then matching the definition of that metadata node/its contents.



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


More information about the llvm-commits mailing list