You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#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.