[PATCH] D55299: [LoopDeletion] Update debug values after loop deletion.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 15:17:55 PST 2018


aprantl added a comment.

This looks like the right & safe thing to do.



================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:372
+  // After the loop has been deleted all the values defined and modified
+  // inside the loop are going to be unavailable.
+  DIBuilder DIB(*ExitBlock->getModule());
----------------
I'd add:
`// Since debug values in the loop have been deleted, inserting an undef dbg.value truncates the range of any dbg.value before the loop where the loop used to be. This is particularly important for constant values.`


================
Comment at: llvm/test/Transforms/LoopDeletion/diundef.ll:24
+  %call = tail call i32 (...) @patatino() #3, !dbg !27
+  %0 = load i32, i32* @a, align 4, !dbg !28, !tbaa !29
+  ret i32 %0, !dbg !33
----------------
we probably can strip all the TBAA info


================
Comment at: llvm/test/Transforms/LoopDeletion/diundef.ll:38
+
+attributes #0 = { nounwind ssp uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
----------------
we can probably remove most of these attributes


================
Comment at: llvm/test/Transforms/LoopDeletion/diundef.ll:64
+!16 = !DILocalVariable(name: "i", scope: !12, file: !3, line: 3, type: !6)
+!17 = !DILocation(line: 3, column: 7, scope: !12)
+!18 = !DILocation(line: 4, column: 8, scope: !19)
----------------
we can probably simplify the metadata by removing the column info


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

https://reviews.llvm.org/D55299





More information about the llvm-commits mailing list