-
Notifications
You must be signed in to change notification settings - Fork 341
[MergeFuncs] Don't introduce calls to (linkonce,weak)_odr functions. #10112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MergeFuncs] Don't introduce calls to (linkonce,weak)_odr functions. #10112
Conversation
@swift-ci please test |
Please test with following PR: @swift-ci test |
Please test with following PR: @swift-ci test |
1 similar comment
Please test with following PR: @swift-ci test |
3aa6707
to
6f09417
Compare
@swift-ci please test |
Tests for llvm#125050. (cherry picked from commit aa77085)
…lvm#125050) Avoid creating new calls to linkonce_odr/weak_odr functions when merging 2 functions, as this may introduce an infinite call cycle. Consider 2 functions below, both present in 2 modules. Module X -- define linkonce_odr void @"A"() { call void @"foo"() } define linkonce_odr void @"B"() { call void @"foo"() } --- Module Y --- global @"g" = @"B" define linkonce_odr void @"A"() { %l = load @"g" call void %l() } define linkonce_odr void @"B"() { call void @"foo"() } --- @"A" and @"B" in both modules are semantically equivalent Module X after function merging: --- define linkonce_odr void @"A"() { call void @"foo"() } define linkonce_odr void @"B"() { call void @"A"() } --- Module Y is unchanged. Then the linker picks @"A" from module Y and @"B" from module X. Now there's an infinite call cycle PR: llvm#125050 (cherry picked from commit f10e0f7)
6f09417
to
6f1edfc
Compare
Please test with following PR: @swift-ci test |
Please test with following PR: @swift-ci test |
Please test with following PR: @swift-ci test |
Avoid creating new calls to linkonce_odr/weak_odr functions when
merging 2 functions, as this may introduce an infinite call
cycle.
Consider 2 functions below, both present in 2 modules.
Module X
--
define linkonce_odr void @"A"() {
call void @"foo"()
}
define linkonce_odr void @"B"() {
call void @"foo"()
}
Module Y
global @"g" = @"B"
define linkonce_odr void @"A"() {
%l = load @"g"
call void %l()
}
define linkonce_odr void @"B"() {
call void @"foo"()
}
@"A" and @"B" in both modules are semantically equivalent
Module X after function merging:
define linkonce_odr void @"A"() {
call void @"foo"()
}
define linkonce_odr void @"B"() {
call void @"A"()
}
Module Y is unchanged.
Then the linker picks @"A" from module Y and @"B" from module X. Now there's an infinite call cycle
PR: llvm#125050
(cherry picked from commit f10e0f7)
rdar://143714290