From 7cabee5b18212bd3106aea8415b044b2b3b43518 Mon Sep 17 00:00:00 2001 From: Sanjiv Gupta Date: Fri, 24 Apr 2009 02:40:57 +0000 Subject: Clang part of r69947. Reverting back 69574 as it is no longer needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69949 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprScalar.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'lib/CodeGen/CGExprScalar.cpp') diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 77771bd937..308a45e433 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -958,14 +958,10 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { } unsigned Width = cast(Idx->getType())->getBitWidth(); - // Only 32 and 64 are valid index widths. So if a target has shorter - // pointe width, extend to 32 at least. - unsigned IdxValidWidth - = (CGF.LLVMPointerWidth < 32) ? 32 : CGF.LLVMPointerWidth; - if (Width < IdxValidWidth) { + if (Width < CGF.LLVMPointerWidth) { // Zero or sign extend the pointer value based on whether the index is // signed or not. - const llvm::Type *IdxType = llvm::IntegerType::get(IdxValidWidth); + const llvm::Type *IdxType = llvm::IntegerType::get(CGF.LLVMPointerWidth); if (IdxExp->getType()->isSignedIntegerType()) Idx = Builder.CreateSExt(Idx, IdxType, "idx.ext"); else @@ -1008,12 +1004,10 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) { // pointer - int Value *Idx = Ops.RHS; unsigned Width = cast(Idx->getType())->getBitWidth(); - unsigned IdxValidWidth - = (CGF.LLVMPointerWidth < 32) ? 32 : CGF.LLVMPointerWidth; - if (Width < IdxValidWidth) { + if (Width < CGF.LLVMPointerWidth) { // Zero or sign extend the pointer value based on whether the index is // signed or not. - const llvm::Type *IdxType = llvm::IntegerType::get(IdxValidWidth); + const llvm::Type *IdxType = llvm::IntegerType::get(CGF.LLVMPointerWidth); if (Ops.E->getRHS()->getType()->isSignedIntegerType()) Idx = Builder.CreateSExt(Idx, IdxType, "idx.ext"); else -- cgit v1.2.3