The bug here is (I believe from just looking at it) that there is a write node using the result of a call but that call node gets replaced early on and so isn't in the type map. Will think and try to push something a little later today
I don't think the issue is resolved by 738383c9595a96e6135b083196ab2a46eed02f5b, I pushed a5fab202b7b9b20b61c0d171db72978306d231c3 which prints out the passes as they run for more clarity. When running cargo run --bin juno juno_samples/cava.jn --verify-all, I see:
Ran pass: VerifyRan pass: GVNRan pass: VerifyRan pass: PhiElimRan pass: VerifyRan pass: DCERan pass: VerifyRan pass: InterproceduralSROARan pass: VerifyRan pass: SROAthread 'main' panicked at hercules_opt/src/pass.rs:649:26:PANIC: Failed to verify Hercules IR module.: "Array constant must store an explicit array type."
This is on the full cava example - I can start with smaller examples first so that it's not as difficult to debug, but I thought I'd post this here in the meantime.
Ran pass: VerifyRan pass: PhiElimRan pass: VerifyRan pass: InlineRan pass: VerifyRan pass: InterproceduralSROARan pass: VerifyRan pass: SROAthread 'main' panicked at hercules_opt/src/pass.rs:649:26:PANIC: Failed to verify Hercules IR module.: "Array constant must store an explicit array type."
Commit 7b380e936f76a5e8edd452c8fecb81b8b918d35f should resolve the issue with Cava. I'm unable to reproduce Ryan's issue, on my end that example fails in verifying the result of inter SROA.