Easy IRgen improvement for bitfields, don't emit x >> 0.

- Logic such as this quite possibly should be optional builder
   behavior.

llvm-svn: 59213
This commit is contained in:
Daniel Dunbar 2008-11-13 02:20:34 +00:00
parent 8553a98b8e
commit f7fb75044f
1 changed files with 3 additions and 2 deletions

View File

@ -214,8 +214,9 @@ RValue CodeGenFunction::EmitLoadOfBitfieldLValue(LValue LV,
llvm::Value *Val = Builder.CreateLoad(Ptr, LV.isVolatileQualified(), "tmp");
// Shift to proper location.
Val = Builder.CreateLShr(Val, llvm::ConstantInt::get(EltTy, StartBit),
"bf.lo");
if (StartBit)
Val = Builder.CreateLShr(Val, llvm::ConstantInt::get(EltTy, StartBit),
"bf.lo");
// Mask off unused bits.
llvm::Constant *LowMask =