diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-11-13 02:20:34 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-11-13 02:20:34 +0000 |
commit | f3edc2fa81b71c32fbc3546be6c0012ff77ec07c (patch) | |
tree | 9b6d8296a2ebaccc81c8aa157acaf2f2c37d8484 /lib/CodeGen/CGExpr.cpp | |
parent | b11e77836dd0867955c5abf32baf1c3e6c7f81e1 (diff) |
Easy IRgen improvement for bitfields, don't emit x >> 0.
- Logic such as this quite possibly should be optional builder
behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 3d8d192a2d..ad2f78b8e7 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -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 = |