Adding extra line unexpectedly breaks optimization remark test

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Adding extra line unexpectedly breaks optimization remark test

Nathan Ridge via cfe-dev
I was updating some tests to work with the new pass manager and I ran into something weird with clang/test/Frontend/optimization-remark-with-hotness.c. If you add a comment (or even just an empty line) before an `expected-remark` in the test, it fails and makes the expected diagnostic not appear anymore.

Original:
```
 56 void bar(int x) {
...
 63   // expected-remark@+1 {{foo inlined into bar with (cost=always): always inliner (hotness:}}
 64   sum += foo(x, x - 2);
 65 }
```

Breaking:
```
 56 void bar(int x) {
...
 63   // random comment
 64   // expected-remark@+1 {{foo inlined into bar with (cost=always): always inliner (hotness:}}
 65   sum += foo(x, x - 2);
 66 }
```

with error:

```
error: 'remark' diagnostics expected but not seen:
  File /usr/local/google/home/leonardchan/llvm-monorepo/llvm-project-2/clang/test/Frontend/optimization-remark-with-hotness.c Line 65 (directive at /usr/local/google/home/leonardchan/llvm-monorepo/llvm-project-2/clang/test/Frontend/optimization-remark-with-hotness.c:65): foo inlined into bar with (cost=always): always inliner (hotness:
1 error generated.
```

This appears to be the case even if the added text is just a newline, or anywhere else within function bar(). I don't think this has to due with changing anything `-verify` checks for since the remark doesn't appear still even without `-verify`.

The run that breaks is:
```
19 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
 20 // RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
 21 // RUN:     -fprofile-sample-use=%t-sample.profdata -Rpass=inline \
 22 // RUN:     -Rpass-analysis=inline -Rpass-missed=inline \
 23 // RUN:     -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 \
 24 // RUN:     -verify
```

The test seems to pass and diagnostic appears if I remove `-fdiagnostics-hotness-threshold=10`. Is it possible that this is intended and extra comments affects hotness?

Thanks,
Leonard

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev