hopefully resolve PR2240
authorChris Lattner <sabre@nondot.org>
Sun, 20 Apr 2008 19:59:12 +0000 (19:59 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 20 Apr 2008 19:59:12 +0000 (19:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49999 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/ConstantFold.cpp

index 50fbe1a00c4c8915635fabca1033c68cf345d89d..9f31bcdb75f30b115e77d2a77ab4c522c5b43e7d 100644 (file)
@@ -571,7 +571,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
           
           if (GVAlign > 1) {
             unsigned DstWidth = CI2->getType()->getBitWidth();
-            unsigned SrcWidth = std::min(SrcWidth, Log2_32(GVAlign));
+            unsigned SrcWidth = std::min(DstWidth, Log2_32(GVAlign));
             APInt BitsNotSet(APInt::getLowBitsSet(DstWidth, SrcWidth));
 
             // If checking bits we know are clear, return zero.