Skip to content

Commit

Permalink
conv:tollvm: Emit ZExt in logical not only when necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jezurko authored and xlauko committed Oct 24, 2023
1 parent 7be0d84 commit bb40f28
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/vast/Conversion/Common/IRsToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,11 @@ namespace vast::conv::irstollvm
auto res_type = this->convert(op.getResult().getType());
if (!res_type)
return logical_result::failure();
rewriter.replaceOpWithNewOp< LLVM::ZExtOp >(op, res_type, xor_val);
if (res_type != xor_val.getType()) {
rewriter.replaceOpWithNewOp< LLVM::ZExtOp >(op, res_type, xor_val);
} else {
rewriter.replaceOp(op, xor_val);
}
return logical_result::success();
}

Expand Down

0 comments on commit bb40f28

Please sign in to comment.