lean4-htt/tests/lean/run/boxing_bug.lean
Henrik Böving b8c53b1d29
chore: remove IR elim dead branches (#11576)
This PR removes the old ElimDeadBranches pass and shifts the new one
past lambda lifting.

The reason for dropping the old one is its general unsoundness and the
fact that we want to do refactorings on the IR part. The reason for
shifting the current pass past lambda lifting, is that its analysis is
imprecise in the presence of local function symbols. I experimented with
the exact placement for a while and it seems like it is optimal here.
Overall we observe a slight regression in the amount of C code
generated, likely because we don't propagate information into lambdas
before lifting them anymore. But generally measure a slight performance
improvement in general.
2025-12-11 10:39:02 +00:00

28 lines
830 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def myCast : NatCast UInt8 where
natCast := UInt8.ofNat
class Semiring (α : Type u) where
[nsmul : SMul Nat α]
/--
trace: [Compiler.IR] [result]
def instSemiringUInt8 : obj :=
let x_1 : obj := pap instSemiringUInt8._lam_0._boxed;
ret x_1
def instSemiringUInt8._lam_0 (x_1 : @& tobj) (x_2 : u8) : u8 :=
let x_3 : u8 := UInt8.ofNat x_1;
let x_4 : u8 := UInt8.mul x_3 x_2;
ret x_4
def instSemiringUInt8._lam_0._boxed (x_1 : tobj) (x_2 : tagged) : tagged :=
let x_3 : u8 := unbox x_2;
let x_4 : u8 := instSemiringUInt8._lam_0 x_1 x_3;
dec x_1;
let x_5 : tagged := box x_4;
ret x_5
-/
#guard_msgs in
set_option trace.compiler.ir.result true in
attribute [local instance] myCast UInt8.intCast in
instance : Semiring UInt8 where
nsmul := ⟨(· * ·)⟩