[GISel]:IRTranslator: Prefer a buidInstr form that allows CSE of cast instructions
authorAditya Nandakumar <aditya_nandakumar@apple.com>
Thu, 18 Apr 2019 02:19:29 +0000 (02:19 +0000)
committerAditya Nandakumar <aditya_nandakumar@apple.com>
Thu, 18 Apr 2019 02:19:29 +0000 (02:19 +0000)
https://reviews.llvm.org/D60844

Use the style of buildInstr that allows CSEing.

llvm-svn: 358637

llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp

index d368be8..09091d3 100644 (file)
@@ -608,7 +608,7 @@ bool IRTranslator::translateCast(unsigned Opcode, const User &U,
                                  MachineIRBuilder &MIRBuilder) {
   unsigned Op = getOrCreateVReg(*U.getOperand(0));
   unsigned Res = getOrCreateVReg(U);
-  MIRBuilder.buildInstr(Opcode).addDef(Res).addUse(Op);
+  MIRBuilder.buildInstr(Opcode, {Res}, {Op});
   return true;
 }