I'm trying to benchmark some code, but the optimizer is basically
removing all of it, so I'm benchmarking nothing.
I'd like to do something like what Chandler Carruth does here to
defeat the optimizer:
https://www.youtube.com/watch?v=nXaxk27zwlk&feature=youtu.be&t=2446
Here presents the following inline asm function to tell the
optimizer that `p` is being used (at least that's how I
understand it):
```
void escape(void* p)
{
asm volatile("" : : "g"(p) : memory);
}
```
I tried to do the same thing in D with this function:
```
void use(void* p)
{
version(LDC)
{
import ldc.llvmasm;
__asm("", "r,~{memory}", p);
}
version(GDC)
{
asm { "" : : "g"(p), "memory"; }
}
}
```
The LDC version seems to work fine:
https://d.godbolt.org/z/qbg54J
But I can't get GDC to do the same:
https://explore.dgnu.org/z/quCjhU
Is this currently possible in GDC?
Mike