jfecher edited issue #3920:
.clif
Test Casefunction u0:0() -> i32 apple_aarch64 { sig0 = (i64) -> i64 fast sig1 = (i64) -> i64 system_v fn0 = colocated u0:2 sig0 fn1 = u0:3 sig1 jt0 = jump_table [block3, block4] block0: v0 = iconst.i64 104 v1 = call fn0(v0) v2 = load.i64 v1 br_table v2, block4, jt0 block3: v3 = load.i64 v1+1 jump block1 block4: jump block2 block1: v5 = call fn1(v3) jump block5(v5) block2: v6 = iconst.i64 0 jump block5(v6) block5(v4: i64): v7 = iconst.i32 0 return v7 }
Apologies I can't seem to find where to install
clif-util
so that I can runclif-util bugpoint
.Steps to Reproduce
Create the above IR via cranelift_jit and the FunctionBuilder API.
Expected Results
Expected the IR to be valid without panicking given that it had passed the
cranelift_codegen::verifier::verify_function
check.Actual Results
Panics with:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Compilation(Verifier(VerifierErrors([VerifierError { location: block0, context: None, me ssage: "cfg had unexpected successor(s) [block3, block4]" }])))', src/cranelift_backend/context.rs:188:14
The line in question is:
module.define_function(function_id, module_context).unwrap();
where
module: cranelift_jit::backend::JITModule
Versions and Environment
Cranelift version or commit: 0.82.1
Operating system: Mac OSX 12.2.1
Architecture: arm64
Extra Info
This function IR fails at
define_function
despite passing thecranelift_codegen::verifier::verify_function
check.
jfecher edited issue #3920:
.clif
Test Casefunction u0:0() -> i32 apple_aarch64 { sig0 = (i64) -> i64 fast sig1 = (i64) -> i64 system_v fn0 = colocated u0:2 sig0 fn1 = u0:3 sig1 jt0 = jump_table [block3, block4] block0: v0 = iconst.i64 104 v1 = call fn0(v0) v2 = load.i64 v1 br_table v2, block4, jt0 block3: v3 = load.i64 v1+1 jump block1 block4: jump block2 block1: v5 = call fn1(v3) jump block5(v5) block2: v6 = iconst.i64 0 jump block5(v6) block5(v4: i64): v7 = iconst.i32 0 return v7 }
Apologies I can't seem to find where to install
clif-util
so that I can runclif-util bugpoint
.Steps to Reproduce
Create the above IR via cranelift_jit and the FunctionBuilder API.
Expected Results
Expected the IR to be valid without panicking given that it had passed the
cranelift_codegen::verifier::verify_function
check.Actual Results
Panics with:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Compilation(Verifier(VerifierErrors([VerifierError { location: block0, context: None, me ssage: "cfg had unexpected successor(s) [block3, block4]" }])))', src/cranelift_backend/context.rs:188:14
The line in question is:
module.define_function(function_id, module_context).unwrap();
where
module: cranelift_jit::backend::JITModule
Versions and Environment
Cranelift version or commit: 0.82.1
Operating system: Mac OSX 12.2.1
Architecture: arm64
Extra Info
This function IR fails at
define_function
despite passing thecranelift_codegen::verifier::verify_function
check.
bjorn3 commented on issue #3920:
Apologies I can't seem to find where to install clif-util so that I can run clif-util bugpoint.
You can use
cd cranelift && cargo run -- bugpoint
.Create the above IR via cranelift_jit and the FunctionBuilder API.
Can you be a bit more specific? Using
clif-util compile crash.clif --target aarch64
works fine for me.
jfecher commented on issue #3920:
Running
cargo run -- bugpoint crash.clif aarch64" gives me
Warning: Given function compiled successfully or gave a verifier error.I'm assuming it compiled correctly since
cargo run -- compile crash.clif --target aarch64` compiles successfully for me. I'll work to try to get a more specific example of how the IR was constructed.
jfecher commented on issue #3920:
I believe I've discovered/fixed my error. I was calling
define_function
after _each_ function finished codegen rather than only after all functions have finished codegen. Sodefine_function(u0:0)
in the above example was being called beforedefine_function(fn0)
ordefine_function(fn1)
jfecher closed issue #3920:
.clif
Test Casefunction u0:0() -> i32 apple_aarch64 { sig0 = (i64) -> i64 fast sig1 = (i64) -> i64 system_v fn0 = colocated u0:2 sig0 fn1 = u0:3 sig1 jt0 = jump_table [block3, block4] block0: v0 = iconst.i64 104 v1 = call fn0(v0) v2 = load.i64 v1 br_table v2, block4, jt0 block3: v3 = load.i64 v1+1 jump block1 block4: jump block2 block1: v5 = call fn1(v3) jump block5(v5) block2: v6 = iconst.i64 0 jump block5(v6) block5(v4: i64): v7 = iconst.i32 0 return v7 }
Apologies I can't seem to find where to install
clif-util
so that I can runclif-util bugpoint
.Steps to Reproduce
Create the above IR via cranelift_jit and the FunctionBuilder API.
Expected Results
Expected the IR to be valid without panicking given that it had passed the
cranelift_codegen::verifier::verify_function
check.Actual Results
Panics with:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Compilation(Verifier(VerifierErrors([VerifierError { location: block0, context: None, me ssage: "cfg had unexpected successor(s) [block3, block4]" }])))', src/cranelift_backend/context.rs:188:14
The line in question is:
module.define_function(function_id, module_context).unwrap();
where
module: cranelift_jit::backend::JITModule
Versions and Environment
Cranelift version or commit: 0.82.1
Operating system: Mac OSX 12.2.1
Architecture: arm64
Extra Info
This function IR fails at
define_function
despite passing thecranelift_codegen::verifier::verify_function
check.
bjorn3 commented on issue #3920:
define_function needs to be called for each individual function. Afterwards the context needs to be cleared using
.clear()
(or discarded entirely) before codegenning the next function.
jfecher commented on issue #3920:
Ah, I believe that was the true error then.
.clear()
wasn't being called after compilingu0:0
.
jfecher edited a comment on issue #3920:
Ah, I believe that was the true error then.
.clear()
wasn't being called after compilingu0:0
. Thanks for your help.
Last updated: Dec 23 2024 at 12:05 UTC