+
+buildExpr binds (AST.If cond thenE elseE) = mdo
+ _ifB <- block `named` "if"
+
+ condV <- buildExpr binds cond
+ when (typeOf condV /= i1) $ lift $ lift $ Left "Not a boolean"
+ condBr condV thenB elseB
+
+ thenB <- block `named` "then"
+ thenOp <- buildExpr binds thenE
+ br mergeB
+
+ elseB <- block `named` "else"
+ elseOp <- buildExpr binds elseE
+ br mergeB
+
+ mergeB <- block `named` "ifcont"
+ traceShowId <$> phi [(thenOp, thenB), (elseOp, elseB)]