| Issue |
53011
|
| Summary |
Make [[clang::nomerge]] work for trap intrinsics such as __debugbreak and __builtin_trap
|
| Labels |
clang:codegen
|
| Assignees |
ZequanWu
|
| Reporter |
rnk
|
Consider:
https://gcc.godbolt.org/z/esvPqdfn9
```
#define NOMERGE [[clang::nomerge]]
bool condition();
void mergeChecks() {
if (condition())
NOMERGE __builtin_trap();
if (condition())
NOMERGE __builtin_trap();
if (condition())
NOMERGE __builtin_trap();
}
```
LLVM folds all these traps together:
```
_Z11mergeChecksv: # @_Z11mergeChecksv
push rax
call _Z9conditionv
test al, al
jne .LBB0_4
call _Z9conditionv
test al, al
jne .LBB0_4
call _Z9conditionv
test al, al
jne .LBB0_4
pop rax
ret
.LBB0_4: # %if.then
ud2
```
Ideally, the nomerge attribute should prevent this. Currently the attribute only really works with call expressions.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs