[llvm] r297044 - GlobalISel: add buildUndef method to MachineIRBuilder. NFC.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 10:36:40 PST 2017


Author: tnorthover
Date: Mon Mar  6 12:36:40 2017
New Revision: 297044

URL: http://llvm.org/viewvc/llvm-project?rev=297044&view=rev
Log:
GlobalISel: add buildUndef method to MachineIRBuilder. NFC.

Modified:
    llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
    llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
    llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp

Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h?rev=297044&r1=297043&r2=297044&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h Mon Mar  6 12:36:40 2017
@@ -451,6 +451,9 @@ public:
   MachineInstrBuilder buildExtract(ArrayRef<unsigned> Results,
                                    ArrayRef<uint64_t> Indices, unsigned Src);
 
+  /// Build and insert \p Res = IMPLICIT_DEF.
+  MachineInstrBuilder buildUndef(unsigned Dst);
+
   /// Build and insert \p Res<def> = G_SEQUENCE \p Op0, \p Idx0...
   ///
   /// G_SEQUENCE inserts each element of Ops into an IMPLICIT_DEF register,

Modified: llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp?rev=297044&r1=297043&r2=297044&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/IRTranslator.cpp Mon Mar  6 12:36:40 2017
@@ -986,7 +986,7 @@ bool IRTranslator::translate(const Const
   else if (auto CF = dyn_cast<ConstantFP>(&C))
     EntryBuilder.buildFConstant(Reg, *CF);
   else if (isa<UndefValue>(C))
-    EntryBuilder.buildInstr(TargetOpcode::IMPLICIT_DEF).addDef(Reg);
+    EntryBuilder.buildUndef(Reg);
   else if (isa<ConstantPointerNull>(C))
     EntryBuilder.buildConstant(Reg, 0);
   else if (auto GV = dyn_cast<GlobalValue>(&C))

Modified: llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp?rev=297044&r1=297043&r2=297044&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp Mon Mar  6 12:36:40 2017
@@ -416,6 +416,10 @@ MachineIRBuilder::buildSequence(unsigned
   return MIB;
 }
 
+MachineInstrBuilder MachineIRBuilder::buildUndef(unsigned Res) {
+  return buildInstr(TargetOpcode::IMPLICIT_DEF).addDef(Res);
+}
+
 MachineInstrBuilder MachineIRBuilder::buildMerge(unsigned Res,
                                                  ArrayRef<unsigned> Ops) {
 




More information about the llvm-commits mailing list