-
Notifications
You must be signed in to change notification settings - Fork 80
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
core: Fix check for forward refs by checking for ssa refs instead of block refs #3851
base: main
Are you sure you want to change the base?
Changes from 18 commits
e44cd87
b86c47e
0bc2616
324792f
83ee4c0
60fd998
9eceb8c
a216535
41b16cd
75fbbe0
617303c
51db69f
4504a60
6e51e9b
9f50033
34ab330
4088e1b
64b9606
2291eb9
b356946
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 |
---|---|---|
|
@@ -53,6 +53,16 @@ builtin.module { | |
|
||
// ----- | ||
|
||
// A graph region that refers to values that are not defined in the module. | ||
|
||
builtin.module { | ||
%0 = "test.termop"(%1, %2) : (i32, i32) -> i32 | ||
} | ||
|
||
// CHECK: values %1, %2 were used but not defined | ||
|
||
// ----- | ||
|
||
// A forward value used with a wrong index | ||
|
||
builtin.module { | ||
|
@@ -73,7 +83,7 @@ builtin.module { | |
"test.op"() : () -> () | ||
} | ||
|
||
// CHECK: /graph_region.mlir:72:4 | ||
// CHECK: /graph_region.mlir:82:4 | ||
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. This is the fun I was hoping to avoid 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. I still think it's worth it :) |
||
// CHECK-NEXT: ^blockA: | ||
// CHECK-NEXT: ^^^^^^^ | ||
// CHECK-NEXT: re-declaration of block 'blockA' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,7 @@ def parse_module(self, allow_implicit_module: bool = True) -> ModuleOp: | |
value_names = ", ".join( | ||
"%" + name for name in self.forward_ssa_references.keys() | ||
) | ||
if len(self.forward_block_references.keys()) > 1: | ||
if len(self.forward_ssa_references.keys()) > 1: | ||
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. This is purely for getting the plural correct it seems 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. ok thanks @alexarice, I updated the description 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. Is this just to purely have a plural and singular form in the error? I don't remember the initial discussion, but wouldn't something like:
work for both cases? 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. I feel this what we do in most places. I was surprised that it tries to get the plural correct here (yet gets it wrong anyway) 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. TBH yeah it seems like a reasonable simplifying change. Maybe even something like this:
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. easier to grep 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. @emmau678 let's update to do something like this? maybe |
||
self.raise_error(f"values {value_names} were used but not defined") | ||
else: | ||
self.raise_error(f"value {value_names} was used but not defined") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the check statement go before the code? I'm also not sure the comment is necessary, the error message describes what is going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved it, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless github is being weird, it seems you moved a different one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment can stay since we are doing it for the rest of the file.
I have a different question though; how does this differ from the test case directly above?
(maybe I need more coffee?)