Skip to content
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

Cranelift: ISLE extraction panics #3743

Open
abrown opened this issue Jan 29, 2022 · 3 comments
Open

Cranelift: ISLE extraction panics #3743

abrown opened this issue Jan 29, 2022 · 3 comments
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language

Comments

@abrown
Copy link
Contributor

abrown commented Jan 29, 2022

When I create a new extractor, one to extract the comparison flag from a comparison referenced by select, ISLE panics.

Steps to Reproduce

Add:

(decl select_fcmp_flag (FloatCC) Inst)
(extractor (select_fcmp_flag comparison_flag)
      (select (def_inst (fcmp comparison_flag a b)) x y))

Then run:

cargo build -p cranelift-codegen --features rebuild-isle

Expected Results

The ISLE code to generate without failure.

Actual Results

  --- stderr
  thread 'main' panicked at 'assertion failed: !tyenv.errors.is_empty()', cranelift/isle/isle/src/sema.rs:1055:29
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Versions and Environment

Cranelift version or commit: latest HEAD

@abrown abrown added bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator labels Jan 29, 2022
@abrown
Copy link
Contributor Author

abrown commented Jan 29, 2022

cc: @fitzgen

@fitzgen
Copy link
Member

fitzgen commented Jan 31, 2022

Standalone reproducer test case:

(type FloatCC (enum))
(type Inst (enum))
(type Value (enum))

(type ValueArray2 (enum))
(decl value_array_2 (Value Value) ValueArray2)
(extern constructor value_array_2 pack_value_array_2)
(extern extractor infallible value_array_2 unpack_value_array_2)

(type ValueArray3 (enum))
(decl value_array_3 (Value Value Value) ValueArray3)
(extern constructor value_array_3 pack_value_array_3)
(extern extractor infallible value_array_3 unpack_value_array_3)

(decl inst_data (InstructionData) Inst)
(extern extractor infallible inst_data inst_data)

(type Opcode extern (enum Fcmp Select))

(type InstructionData (enum (FloatCompare (opcode Opcode) (args ValueArray2) (cond FloatCC))
                            (Ternary (opcode Opcode) (args ValueArray3))))

(decl def_inst (Inst) Value)
(extern extractor def_inst def_inst)

(decl fcmp (FloatCC Value Value) Inst)
(extractor
 (fcmp Cond x y)
 (inst_data (InstructionData.FloatCompare (Opcode.Fcmp) (value_array_2 x y) Cond)))

(decl select (Value Value Value) Inst)
(extractor
 (select c x y)
 (inst_data (InstructionData.Ternary (Opcode.Select) (value_array_3 c x y))))

(decl select_fcmp_flag (FloatCC) Inst)
(extractor (select_fcmp_flag comparison_flag)
           (select (def_inst (fcmp comparison_flag a b)) x y))

@fitzgen fitzgen added the isle Related to the ISLE domain-specific language label Feb 14, 2022
@github-actions
Copy link

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language
Projects
Status: No status
Development

No branches or pull requests

2 participants