def two_stage(A):
var = hcl.scalar(0, "v", dtype=hcl.UInt(32))
var.v = 1
with hcl.if_(var == 0):
hcl.print((),"A\n")
with hcl.else_():
var.v = var - 1
with hcl.if_(var == 0):
hcl.print((),"B\n")
return A
Notice that the "else" block no longer has the "with hcl.if(var == 0): hcl.print((), "B\n") statements. It looks like the second hcl.if block was optimized away since it is the same expression as the initial hcl.if without considering that var changed (decremented).
Given code:
The lowered IR is:
Notice that the "else" block no longer has the "with hcl.if(var == 0): hcl.print((), "B\n") statements. It looks like the second hcl.if block was optimized away since it is the same expression as the initial hcl.if without considering that var changed (decremented).