avoid useless icmp-ne insertion in visitor
This commit is contained in:
parent
b5e1610047
commit
5e6107a02e
@ -533,7 +533,9 @@ std::any Visitor::visitLAndExp(SysyParser::LAndExpContext *ctx) {
|
|||||||
for (int i = 0; i < eq_exp_list.size(); ++i) {
|
for (int i = 0; i < eq_exp_list.size(); ++i) {
|
||||||
auto next_block = build_BasicBlock("", _state.current_func, _state.current_bb->itr);
|
auto next_block = build_BasicBlock("", _state.current_func, _state.current_bb->itr);
|
||||||
auto eq_exp = any_to_Value(visitEqExp(eq_exp_list[i]));
|
auto eq_exp = any_to_Value(visitEqExp(eq_exp_list[i]));
|
||||||
auto condition = build_InstBinary(InstTag::Ne, eq_exp, CONST0, _state.current_bb);
|
auto condition = eq_exp;
|
||||||
|
if (!TypeHelper::isIntegerTypeI1(eq_exp->type))
|
||||||
|
condition = build_InstBinary(InstTag::Ne, eq_exp, CONST0, _state.current_bb);
|
||||||
build_InstBranch(condition, next_block, ctx->false_block, _state.current_bb);
|
build_InstBranch(condition, next_block, ctx->false_block, _state.current_bb);
|
||||||
_state.current_bb = next_block;
|
_state.current_bb = next_block;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user