[libcxx-commits] [libcxx] [libcxx] Improve handling of DummyData blocks in libcxx tests (PR #88897)

Jack Styles via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 17 02:47:41 PDT 2024


Stylie777 wrote:

> Sorry if I am missing something obvious, but I basically don't understand this change. You mention that "the compiler cannot properly compare the values", what do you mean by that?

@ldionne  Apologies, not sure I explained it very well there. 

The issue that has been observed is that with certain configurations when using C++17, when comparing the pointers of `x` and `DummyData`, they result was coming out as false when the pointers are identical (see below). This was occurring on 6 tests, 3 of which can be remedied by utilising a different `DoNotOptimize` function that uses the input and output from the inline asm. The other three I used the class to define the DummyData, as then this removes the issues that can arise from comparing a global pointer to that of a local one. 

Example:
```
0000000000060940 <- `x`
0000000000060940 <- `DummyData`
0 <- (x == DummyData)
```

This is running on AArch64 V8 with the following compile options: `--target=aarch64-none-elf -march=armv8 -std=c++17 -O2`

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


More information about the libcxx-commits mailing list