[llvm] r352873 - [InstCombine] reduce duplicate code; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 1 06:37:49 PST 2019


Author: spatel
Date: Fri Feb  1 06:37:49 2019
New Revision: 352873

URL: http://llvm.org/viewvc/llvm-project?rev=352873&view=rev
Log:
[InstCombine] reduce duplicate code; NFC

An unused variable problem was introduced with rL352870 
and stubbed out with rL352871, but we can make a better
fix by actually using the local variable in code rather 
than just the assert.  

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=352873&r1=352872&r2=352873&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Fri Feb  1 06:37:49 2019
@@ -761,7 +761,6 @@ static Value *simplifyX86addcarry(const
   assert(RetTy->getStructElementType(0)->isIntegerTy(8) &&
          RetTy->getStructElementType(1) == OpTy && OpTy == Op2->getType() &&
          "Unexpected types for x86 addcarry");
-  (void)RetTy;
 
   // If carry-in is zero, this is just an unsigned add with overflow.
   if (match(CarryIn, m_ZeroInt())) {
@@ -771,7 +770,7 @@ static Value *simplifyX86addcarry(const
     Value *UAddResult = Builder.CreateExtractValue(UAdd, 0);
     Value *UAddOV = Builder.CreateZExt(Builder.CreateExtractValue(UAdd, 1),
                                        Builder.getInt8Ty());
-    Value *Res = UndefValue::get(II.getType());
+    Value *Res = UndefValue::get(RetTy);
     Res = Builder.CreateInsertValue(Res, UAddOV, 0);
     return Builder.CreateInsertValue(Res, UAddResult, 1);
   }




More information about the llvm-commits mailing list