For PR1271:
authorReid Spencer <rspencer@reidspencer.com>
Mon, 26 Mar 2007 05:25:00 +0000 (05:25 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 26 Mar 2007 05:25:00 +0000 (05:25 +0000)
Fix SingleSource/Regression/C/2003-05-21-UnionBitFields.c by changing a
getHighBitsSet call to getLowBitsSet call that was incorrectly converted
from the original lshr constant expression.

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

lib/Transforms/Scalar/InstructionCombining.cpp

index 0105128693425ac63769b089501636f809a87f45..586c7b1fb10cb0a9ded11d9f880b40b8a962d71c 100644 (file)
@@ -5858,7 +5858,7 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
           BinaryOperator::createLShr(X, ConstantInt::get(Ty, ShiftDiff));
         InsertNewInstBefore(Shift, I);
         
-        APInt Mask(APInt::getHighBitsSet(TypeBits, TypeBits - ShiftAmt2));
+        APInt Mask(APInt::getLowBitsSet(TypeBits, ShiftAmt2));
         return BinaryOperator::createAnd(Shift, ConstantInt::get(Mask));
       }