Endilll wrote:
Our C++ DR test suite has little codegen tests (around 3 or 4, depending on how
you count). This rather simple DR about order of destruction of stack unwinding
aims to establish a precedent for how such test should be written. Specific
points I'd like to highlight:
1. Use of `llvm-cxxfilt`. This improves readability, but is rarely used in
Clang and LLVM test suites. On this note, I don't really understand why `-n` is
important, but it's present in most of the usages of `llvm-cxxfilt`.
2. Hard-coding register names. It doesn't feel good to hard-code them, but
again helps readability. I'll leave a rewrite of this test without hard-coded
register names. It should be noted that in this particular case names have been
stable for 12 years [since 3.0](https://godbolt.org/z/jGW5T5fvx).
3. Richard has left 25 TODOs for codegen tests while working on DRs 0 through
700. I hope those are just TODOs, and not an indication that there are
fundamental problems with this kind of tests. CC @zygoloid
Test without register names hard-coded is going to look along those lines:
```
// CHECK: invoke void @dr1807::S::S(){{.+}}
// CHECK-NEXT: {{.+}} unwind label %[[LPAD:[a-z]+]]
// CHECK-LABEL: [[LPAD]]:
// CHECK: br {{.+}}, label {{.+}}, label
%[[ARRAYDESTROY_BODY:[a-z.]+]]
// CHECK-LABEL: [[ARRAYDESTROY_BODY]]:
// CHECK: %[[ARRAYDESTROY_ELEMENT:[a-z.]+]] = getelementptr
{{.+}}, i64 -1
// CXX98-NEXT: invoke void
@dr1807::S::~S(){{.*}}%[[ARRAYDESTROY_ELEMENT]]
// SINCE-CXX11-NEXT: call void @dr1807::S::~S(){{.*}}%[[ARRAYDESTROY_ELEMENT]]
```
https://github.com/llvm/llvm-project/pull/77637
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits