public CFGResult computeIf(Block condBlock, ArithmeticResult cond, CFGResult then,
			CFGResult elseResult) {
		if (cond.getKind() == Kind.CONST) { // the branch result is fixed.
			if (cond.getConstValue() > 0) {
				return then;
			} else if (elseResult != null) {
				return elseResult;
			} else {
				return CFGResult.EMPTY_CFG_RESULT;
			}
		} else {
			CFGResult result = new CFGResult(condBlock);
			condBlock.putCode(mapTokenTypeToOP(TokenType.getNegRelation(cond.getRelation())),
					cond.getVariable());
			condBlock.setNext(then.getFirstBlock());
			then.getFirstBlock().setNormalPre(condBlock);
			if (elseResult != null) {
				condBlock.condNegBranch(elseResult.getFirstBlock());
				elseResult.getFirstBlock().setNormalPre(condBlock);

				Block phiBlock = Block.createJoinPointBlock(then.getLastBlock().getLocalVarTable(),
						elseResult.getLastBlock().getLocalVarTable(), then.getLastBlock()
								.getGlobalVarTable());
				then.getLastBlock().putCode(OP.BRA, new SSAVar(phiBlock.getID()));
				then.getLastBlock().setNext(phiBlock);
				elseResult.getLastBlock().setNext(phiBlock);
				phiBlock.setThenPre(then.getLastBlock());
				phiBlock.setElsePre(elseResult.getLastBlock());
				result.setTail(phiBlock);
			} else {
				Block emptyElseBlock = new Block(condBlock.getLocalVarTable(),
						condBlock.getGlobalVarTable());
				Block phiBlock = Block.createJoinPointBlock(then.getLastBlock().getLocalVarTable(),
						condBlock.getLocalVarTable(), then.getLastBlock().getGlobalVarTable());

				condBlock.condNegBranch(emptyElseBlock);
				emptyElseBlock.setNormalPre(condBlock);
				emptyElseBlock.setNext(phiBlock);

				phiBlock.setElsePre(emptyElseBlock);
				then.getLastBlock().putCode(OP.BRA, new SSAVar(phiBlock.getID()));
				then.getLastBlock().setNext(phiBlock);
				phiBlock.setThenPre(then.getLastBlock());
				result.setTail(phiBlock);
			}

			return result;
		}
	}