-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[StructuralHash] Support Differences #112638
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
14f0691
[StructuralHash] Support Differences
kyulee-com 6c35be8
Address comments from ellishg
kyulee-com 24768bb
Address comments from ilovepi
kyulee-com 14aa138
Address 2nd comments from ellishg
kyulee-com d3c35a7
Address 3rd comments from ellishg
kyulee-com File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
; RUN: opt -passes='print<structural-hash>' -disable-output %s 2>&1 | FileCheck %s | ||
; RUN: opt -passes='print<structural-hash><detailed>' -disable-output %s 2>&1 | FileCheck %s -check-prefix=DETAILED-HASH | ||
; RUN: opt -passes='print<structural-hash><call-target-ignored>' -disable-output %s 2>&1 | FileCheck %s -check-prefix=CALLTARGETIGNORED-HASH | ||
|
||
; Add a declaration so that we can test we skip it. | ||
declare i64 @d1() | ||
declare i64 @d1(i64) | ||
declare i64 @e1(i64) | ||
|
||
define i64 @f1(i64 %a) { | ||
%b = add i64 %a, 1 | ||
ret i64 %b | ||
%c = call i64 @d1(i64 %b) | ||
ret i64 %c | ||
} | ||
|
||
define i32 @f2(i32 %a) { | ||
%b = add i32 %a, 2 | ||
ret i32 %b | ||
define i64 @f2(i64 %a) { | ||
%b = add i64 %a, 1 | ||
%c = call i64 @e1(i64 %b) | ||
ret i64 %c | ||
} | ||
|
||
; CHECK: Module Hash: {{([a-f0-9]{16,})}} | ||
|
@@ -22,3 +26,13 @@ define i32 @f2(i32 %a) { | |
; DETAILED-HASH-NEXT: Function f1 Hash: [[DF1H:([a-f0-9]{16,})]] | ||
; DETAILED-HASH-NOT: [[DF1H]] | ||
; DETAILED-HASH-NEXT: Function f2 Hash: {{([a-f0-9]{16,})}} | ||
|
||
; When ignoring the call target, check if `f1` and `f2` produce the same function hash. | ||
; The index for the call instruction is 1, and the index of the call target operand is 1. | ||
; The ignored operand hashes for different call targets should be different. | ||
; CALLTARGETIGNORED-HASH: Module Hash: {{([a-f0-9]{16,})}} | ||
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. Since these are stable hashes. What do you think about adding the literal hash into the test? This would allow us to know exactly when the hash was changed, otherwise the test fails. I see that you do check that f1 and f2 hash to the same value. Maybe that is good enough. |
||
; CALLTARGETIGNORED-HASH-NEXT: Function f1 Hash: [[IF1H:([a-f0-9]{16,})]] | ||
; CALLTARGETIGNORED-HASH-NEXT: Ignored Operand Hash: [[IO1H:([a-f0-9]{16,})]] at (1,1) | ||
; CALLTARGETIGNORED-HASH-NEXT: Function f2 Hash: [[IF1H]] | ||
; CALLTARGETIGNORED-HASH-NOT: [[IO1H]] | ||
; CALLTARGETIGNORED-HASH-NEXT: Ignored Operand Hash: {{([a-f0-9]{16,})}} at (1,1) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.