-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Ignore !guid metadata when merging globals or constants
#200323
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| ; We can merge globals with a guid metadata, and the guid of the merged object | ||
| ; is different from that of the original objects. | ||
| ; RUN: opt -passes='global-merge<max-offset=100>' -S -o - %s | FileCheck %s | ||
|
|
||
| target datalayout = "e-p:64:64" | ||
| target triple = "x86_64-unknown-linux-gnu" | ||
|
|
||
| ; CHECK: @_MergedGlobals = private global <{ i32, i32 }> <{ i32 1, i32 2 }>, align 4, !guid !0 | ||
| ; CHECK: @_MergedGlobals.1 = private global <{ i32, i32 }> <{ i32 3, i32 4 }>, section "foo", align 4, !guid !1 | ||
|
|
||
| ; CHECK-DAG: @a = internal alias i32, ptr @_MergedGlobals{{$}} | ||
| @a = internal global i32 1, !guid !{i64 1} | ||
|
|
||
| ; CHECK-DAG: @b = internal alias i32, getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1) | ||
| @b = internal global i32 2, !guid !{i64 2} | ||
|
|
||
| ; CHECK-DAG: @c = internal alias i32, ptr @_MergedGlobals.1{{$}} | ||
| @c = internal global i32 3, section "foo", !guid !{i64 3} | ||
|
|
||
| ; CHECK-DAG: @d = internal alias i32, getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals.1, i32 0, i32 1) | ||
| @d = internal global i32 4, section "foo", !guid !{i64 4} | ||
|
|
||
| ; CHECK: define void @use() !guid !2 | ||
| define void @use() !guid !{i64 5} { | ||
| ; CHECK: load i32, ptr @_MergedGlobals, | ||
| %x = load i32, ptr @a | ||
| ; CHECK: load i32, ptr getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals, i32 0, i32 1) | ||
| %y = load i32, ptr @b | ||
| ; CHECK: load i32, ptr @_MergedGlobals.1 | ||
| %z1 = load i32, ptr @c | ||
| ; CHECK: load i32, ptr getelementptr inbounds (<{ i32, i32 }>, ptr @_MergedGlobals.1, i32 0, i32 1) | ||
| %z2 = load i32, ptr @d | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK: !0 = !{i64 {{-?[0-9][0-9]+}}} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not compare against the exact guid values we expect in !0 and !1?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We expect anything but 0 or 1 - because these are supposed to be freshly recomputed. The module name is test-dependent, and, anyway, will be a large int, so we check that we have 2 or more digits. |
||
| ; CHECK: !1 = !{i64 {{-?[0-9][0-9]+}}} | ||
| ; CHECK: !2 = !{i64 5} | ||
Uh oh!
There was an error while loading. Please reload this page.