diff options
-rw-r--r-- | include/llvm/Instructions.h | 6 | ||||
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 61d0efafe5..236a1fdcce 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -255,8 +255,7 @@ public: /// getAlignment - Return the alignment of the access that is being performed /// unsigned getAlignment() const { - signed Log2AlignVal = ((SubclassData>>1)-1); - return ((Log2AlignVal < 0) ? 0 : 1<<Log2AlignVal); + return (1 << (SubclassData>>1)) >> 1; } void setAlignment(unsigned Align); @@ -331,8 +330,7 @@ public: /// getAlignment - Return the alignment of the access that is being performed /// unsigned getAlignment() const { - signed Log2AlignVal = ((SubclassData>>1)-1); - return ((Log2AlignVal < 0) ? 0 : 1<<Log2AlignVal); + return (1 << (SubclassData>>1)) >> 1; } void setAlignment(unsigned Align); diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index 7ac784ecc7..98ed57ea6f 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/lib/Bytecode/Reader/Reader.cpp @@ -834,9 +834,8 @@ void BytecodeReader::ParseInstruction(SmallVector<unsigned, 8> &Oprnds, case 62: { // attributed load if (Oprnds.size() != 2 || !isa<PointerType>(InstTy)) error("Invalid attributed load instruction!"); - signed Log2AlignVal = ((Oprnds[1]>>1)-1); Result = new LoadInst(getValue(iType, Oprnds[0]), "", (Oprnds[1] & 1), - ((Log2AlignVal < 0) ? 0 : 1<<Log2AlignVal)); + (1 << (Oprnds[1]>>1)) >> 1); break; } case Instruction::Load: @@ -850,10 +849,9 @@ void BytecodeReader::ParseInstruction(SmallVector<unsigned, 8> &Oprnds, Value *Ptr = getValue(iType, Oprnds[1]); const Type *ValTy = cast<PointerType>(Ptr->getType())->getElementType(); - signed Log2AlignVal = ((Oprnds[2]>>1)-1); Result = new StoreInst(getValue(getTypeSlot(ValTy), Oprnds[0]), Ptr, (Oprnds[2] & 1), - ((Log2AlignVal < 0) ? 0 : 1<<Log2AlignVal)); + (1 << (Oprnds[2]>>1)) >> 1); break; } case Instruction::Store: { |