diff options
author | Joseph Huber <huberjn@outlook.com> | 2024-02-08 17:16:31 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-08 17:16:31 -0600 |
commit | 9211e67da36782db44a46ccb9ac06734ccf2570f (patch) | |
tree | 1f1ac7bf56040e4d97503c4611bb1356b418d2fb /llvm/lib/Object/WasmObjectFile.cpp | |
parent | 9affa177b526459beddafad30474d2e3186376e4 (diff) | |
download | llvm-9211e67da36782db44a46ccb9ac06734ccf2570f.zip llvm-9211e67da36782db44a46ccb9ac06734ccf2570f.tar.gz llvm-9211e67da36782db44a46ccb9ac06734ccf2570f.tar.bz2 |
[NVVMReflect] Force dead branch elimination in NVVMReflect (#81189)
Summary:
The `__nvvm_reflect` function is used to guard invalid code that varies
between architectures. One problem with this feature is that if it is
used without optimizations, it will leave invalid code in the module
that will then make it to the backend. The `__nvvm_reflect` pass is
already mandatory, so it should do some trivial branch removal to ensure
that constants are handled correctly. This dead branch elimination only
works in the trivial case of a compare on a branch and does not touch
any conditionals that were not realted to the `__nvvm_reflect` call in
order to preserve `O0` semantics as much as possible. This should allow
the following to work on NVPTX targets
```c
int foo() {
if (__nvvm_reflect("__CUDA_ARCH") >= 700)
asm("valid;\n");
}
```
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions