Use getZExtOrTrunc helper instead of manually doing zext/trunc check. NFC.
authorPete Cooper <peter_cooper@apple.com>
Wed, 15 Jul 2015 00:43:54 +0000 (00:43 +0000)
committerPete Cooper <peter_cooper@apple.com>
Wed, 15 Jul 2015 00:43:54 +0000 (00:43 +0000)
The code here was doing exactly what is already in getZExtOrTrunc().
Just use that method instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242260 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 21ab07234c815641433c5b83a14f916c46283987..51057a0fecb7144ad66a17085ab9c7c22cf50184 100644 (file)
@@ -599,8 +599,7 @@ PerformInsertVectorEltInMemory(SDValue Vec, SDValue Val, SDValue Idx,
                             false, false, 0);
 
   // Truncate or zero extend offset to target pointer type.
-  unsigned CastOpc = IdxVT.bitsGT(PtrVT) ? ISD::TRUNCATE : ISD::ZERO_EXTEND;
-  Tmp3 = DAG.getNode(CastOpc, dl, PtrVT, Tmp3);
+  Tmp3 = DAG.getZExtOrTrunc(Tmp3, dl, PtrVT);
   // Add the offset to the index.
   unsigned EltSize = EltVT.getSizeInBits()/8;
   Tmp3 = DAG.getNode(ISD::MUL, dl, IdxVT, Tmp3,
index 817ccb45c3162bdce65b10123ce4e47d9b205930..d41d46b7b14cc4e68efa0bb8f1fed7cb55eb4b8a 100644 (file)
@@ -1852,8 +1852,7 @@ SDValue SelectionDAG::getShiftAmountOperand(EVT LHSTy, SDValue Op) {
   EVT ShTy = TLI->getShiftAmountTy(LHSTy, getDataLayout());
   if (OpTy == ShTy || OpTy.isVector()) return Op;
 
-  ISD::NodeType Opcode = OpTy.bitsGT(ShTy) ?  ISD::TRUNCATE : ISD::ZERO_EXTEND;
-  return getNode(Opcode, SDLoc(Op), ShTy, Op);
+  return getZExtOrTrunc(Op, SDLoc(Op), ShTy);
 }
 
 /// CreateStackTemporary - Create a stack temporary, suitable for holding the