diff options
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index ae7518a2b9..fb5f58ddbb 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -2368,8 +2368,12 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &op) { } Value *ScalarExprEmitter::GetWidthMinusOneValue(Value* LHS,Value* RHS) { - unsigned Width = cast<llvm::IntegerType>(LHS->getType())->getBitWidth(); - return llvm::ConstantInt::get(RHS->getType(), Width - 1); + llvm::IntegerType *Ty; + if (llvm::VectorType *VT = dyn_cast<llvm::VectorType>(LHS->getType())) + Ty = cast<llvm::IntegerType>(VT->getElementType()); + else + Ty = cast<llvm::IntegerType>(LHS->getType()); + return llvm::ConstantInt::get(RHS->getType(), Ty->getBitWidth() - 1); } Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) { |