[PATCH] D147177: [FunctionAttrs] allow weak functions to propagate noreturn
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 14:28:33 PDT 2023
jdoerfert added a comment.
I don't think this is sound. Refinement again:
static I = 0;
__attribute__((weak)) void weak() {
unspecified_order(++I, UB_if_I_is_non_zero());
}
Order 1:
static I = 0;
__attribute__((weak)) void weak() {
auto _T1 = ++I;
auto _T2 = UB_if_I_is_non_zero();
unspecified_order(_T1, _T2);
// weak is now noreturn because we hit UB computing _T2.
}
Order 2:
static I = 0;
__attribute__((weak)) void weak() {
auto _T1 = UB_if_I_is_non_zero();
auto _T2 = ++I;
unspecified_order(_T2, _T1);
// weak is not noreturn and optimizing call sites with it will cause problems if we pick this version.
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147177/new/
https://reviews.llvm.org/D147177
More information about the llvm-commits
mailing list