From: Vang Thao Date: Tue, 4 May 2021 23:43:07 +0000 (-0700) Subject: [GlobalISel] Fix buildZExtInReg creating new register. X-Git-Tag: llvmorg-14-init~7550 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3d273c9ff4c789aec0dc743fa2dc846b5987312;p=platform%2Fupstream%2Fllvm.git [GlobalISel] Fix buildZExtInReg creating new register. Fix a bug where buildZExtInReg will create and use a new register instead of using the register from parameter DstOp Res. Reviewed By: arsenm, foad Differential Revision: https://reviews.llvm.org/D101871 --- diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index bde442a..1f86bfa 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -492,7 +492,7 @@ MachineInstrBuilder MachineIRBuilder::buildZExtInReg(const DstOp &Res, LLT ResTy = Res.getLLTTy(*getMRI()); auto Mask = buildConstant( ResTy, APInt::getLowBitsSet(ResTy.getScalarSizeInBits(), ImmOp)); - return buildAnd(ResTy, Op, Mask); + return buildAnd(Res, Op, Mask); } MachineInstrBuilder MachineIRBuilder::buildCast(const DstOp &Dst,