-
Notifications
You must be signed in to change notification settings - Fork 791
Fix IRBuilder location tracking of If starts #7617
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 |
---|---|---|
|
@@ -259,6 +259,128 @@ | |
) | ||
) | ||
|
||
;; CHECK: (func $branch-hints-if-else (type $0) (param $x i32) | ||
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. In addition to this test, can we have another test that directly shows the correct binary offsets? Or do we not have a way to print IR annotated with binary offsets? 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. Hmm, we don't have an option to show binary offsets by a flag. We show them when DWARF sections exist, or code annotations, atm. Might be worth adding though. |
||
;; CHECK-NEXT: (@metadata.code.branch_hint "\01") | ||
;; CHECK-NEXT: (if | ||
;; CHECK-NEXT: (local.get $x) | ||
;; CHECK-NEXT: (then | ||
;; CHECK-NEXT: (drop | ||
;; CHECK-NEXT: (i32.const 1) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (else | ||
;; CHECK-NEXT: (drop | ||
;; CHECK-NEXT: (i32.const 0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; RTRIP: (func $branch-hints-if-else (type $0) (param $x i32) | ||
;; RTRIP-NEXT: (@metadata.code.branch_hint "\01") | ||
;; RTRIP-NEXT: (if | ||
;; RTRIP-NEXT: (local.get $x) | ||
;; RTRIP-NEXT: (then | ||
;; RTRIP-NEXT: (drop | ||
;; RTRIP-NEXT: (i32.const 1) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: (else | ||
;; RTRIP-NEXT: (drop | ||
;; RTRIP-NEXT: (i32.const 0) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: ) | ||
;; SRCMP: (func $branch-hints-if-else (type $0) (param $x i32) | ||
;; SRCMP-NEXT: (@metadata.code.branch_hint "\01") | ||
;; SRCMP-NEXT: (if | ||
;; SRCMP-NEXT: (local.get $x) | ||
;; SRCMP-NEXT: (then | ||
;; SRCMP-NEXT: (drop | ||
;; SRCMP-NEXT: (i32.const 1) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: (else | ||
;; SRCMP-NEXT: (drop | ||
;; SRCMP-NEXT: (i32.const 0) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: ) | ||
(func $branch-hints-if-else (param $x i32) | ||
(@metadata.code.branch_hint "\01") | ||
(if | ||
(local.get $x) | ||
(then | ||
(drop | ||
(i32.const 1) | ||
) | ||
) | ||
(else | ||
(drop | ||
(i32.const 0) | ||
) | ||
) | ||
) | ||
) | ||
|
||
;; CHECK: (func $branch-hints-if-else-result (type $0) (param $x i32) | ||
;; CHECK-NEXT: (drop | ||
;; CHECK-NEXT: (@metadata.code.branch_hint "\01") | ||
;; CHECK-NEXT: (if (result i32) | ||
;; CHECK-NEXT: (local.get $x) | ||
;; CHECK-NEXT: (then | ||
;; CHECK-NEXT: (i32.const 1) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: (else | ||
;; CHECK-NEXT: (i32.const 0) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; RTRIP: (func $branch-hints-if-else-result (type $0) (param $x i32) | ||
;; RTRIP-NEXT: (drop | ||
;; RTRIP-NEXT: (@metadata.code.branch_hint "\01") | ||
;; RTRIP-NEXT: (if (result i32) | ||
;; RTRIP-NEXT: (local.get $x) | ||
;; RTRIP-NEXT: (then | ||
;; RTRIP-NEXT: (i32.const 1) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: (else | ||
;; RTRIP-NEXT: (i32.const 0) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: ) | ||
;; RTRIP-NEXT: ) | ||
;; SRCMP: (func $branch-hints-if-else-result (type $0) (param $x i32) | ||
;; SRCMP-NEXT: (drop | ||
;; SRCMP-NEXT: (@metadata.code.branch_hint "\01") | ||
;; SRCMP-NEXT: (if (result i32) | ||
;; SRCMP-NEXT: (local.get $x) | ||
;; SRCMP-NEXT: (then | ||
;; SRCMP-NEXT: (i32.const 1) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: (else | ||
;; SRCMP-NEXT: (i32.const 0) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: ) | ||
;; SRCMP-NEXT: ) | ||
(func $branch-hints-if-else-result (param $x i32) | ||
(drop | ||
(@metadata.code.branch_hint "\01") | ||
(if (result i32) | ||
(local.get $x) | ||
(then | ||
(i32.const 1) | ||
) | ||
(else | ||
(i32.const 0) | ||
) | ||
) | ||
) | ||
) | ||
|
||
;; CHECK: (func $branch-hints-br_on (type $1) (param $x anyref) | ||
;; CHECK-NEXT: (block $out | ||
;; CHECK-NEXT: (drop | ||
|
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 we either fix this for
try-catch
as well, or add a TODO to do so?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.
Added a TODO. I'm not sure offhand how to handle multiple catches. Anyhow, only If is urgent atm.