[llvm] r370224 - Reduce scope of variable only used in a local pattern match. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 09:06:34 PDT 2019


Author: rksimon
Date: Wed Aug 28 09:06:33 2019
New Revision: 370224

URL: http://llvm.org/viewvc/llvm-project?rev=370224&view=rev
Log:
Reduce scope of variable only used in a local pattern match. NFCI.

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

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=370224&r1=370223&r2=370224&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Wed Aug 28 09:06:33 2019
@@ -610,7 +610,6 @@ Value *InstCombiner::tryFactorization(Bi
           HasNUW &= ROBO->hasNoUnsignedWrap();
         }
 
-        const APInt *CInt;
         if (TopLevelOpcode == Instruction::Add &&
             InnerOpcode == Instruction::Mul) {
           // We can propagate 'nsw' if we know that
@@ -620,6 +619,7 @@ Value *InstCombiner::tryFactorization(Bi
           //  %Z = mul nsw i16 %X, C+1
           //
           // iff C+1 isn't INT_MIN
+          const APInt *CInt;
           if (match(V, m_APInt(CInt))) {
             if (!CInt->isMinSignedValue())
               BO->setHasNoSignedWrap(HasNSW);




More information about the llvm-commits mailing list