[PATCH] D29203: Change debug-info-for-profiling from a TargetOption to a function attribute.

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 17:53:53 PST 2017


probinson added a comment.

Is there a reason to make this a function attribute rather than a flag carried in the metadata?  Having something related to debug info as an attribute seems odd.



================
Comment at: test/DebugInfo/Inputs/gmlt_profiling.ll:5
+; void f1() {}
+; void __attribute__((section("__TEXT,__bar"))) f2() {}
+; void __attribute__((always_inline)) f3() { f1(); }
----------------
f2() does not appear in any checks and is not used anywhere else in the test. Why is it here?


================
Comment at: test/DebugInfo/Inputs/gmlt_profiling.ll:7
+; void __attribute__((always_inline)) f3() { f1(); }
+; void f4() { f3(); }
+
----------------
f3() and f4() do not appear in any checks, why are they here?


================
Comment at: test/DebugInfo/Inputs/gmlt_profiling.ll:14
+; CHECK: DW_AT_decl_file
+; CHECK: DW_AT_decl_line
+
----------------
Writing checks for dwarfdump output is tricky because you're really trying to match several attribute lines within the same DWARF entry.  So here you want something like this:
```
CHECK: DW_TAG_subprogram
CHECK-NOT: {{DW_TAG|NULL}}
CHECK: DW_AT_name {{.*}} "f1"
CHECK-NEXT: DW_AT_decl_file
CHECK-NEXT: DW_AT_decl_line
```

This assumes that name/file/line appear in that exact sequence, but there are lots of debug-info tests with that kind of assumption.  Unless/until we get a fancier debug-info matcher this is the kind of thing we have to do.


================
Comment at: test/DebugInfo/Inputs/gmlt_profiling.ll:43
+attributes #0 = { nounwind uwtable "debug-info-for-profiling"="true" "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" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { alwaysinline nounwind uwtable "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" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { nounwind }
----------------
Generally we encourage people to remove attributes that aren't relevant or necessary to the test. Here, probably only "debug-info-for-profiling" is the relevant one?  Removing the others helps clarify what the test is about.


https://reviews.llvm.org/D29203





More information about the llvm-commits mailing list