SSA pass producing unnecessary phi nodes
The following example will produce a phi node for 'a' even thought it is unneeded. This causes problems when the types of 'a' in each branch are different
def foo(pred : Bit, x : BitVector[16]):
if pred:
a = Signed[16](x)
b = a > 0
else:
a = Unsigned[16](x)
b = a > 0
#code that never uses 'a' again
If a is never used again I would immagine dead code elimination in the rtl compiler would optimize this away. Is there evidence that this effect QOR?
The problem is when 'a' is a different type in each branch. The extraneous phi node causes type errors.
Ahh I see. While possible, this is actually quite annoying to fix. Could we work around this for now?
@leonardt, it seems that magma handles this case without erroring. Is there a way to leverage what you have written?