diff options
| author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-04-24 02:40:57 +0000 |
|---|---|---|
| committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-04-24 02:40:57 +0000 |
| commit | 474251577163d262d4907466f8c3688b1aeea5c6 (patch) | |
| tree | b45e392b2f5189f0d85a6a43a44591d49e6c1389 /clang/lib/CodeGen/CGExprScalar.cpp | |
| parent | 640a161c73db421c30a6514f1bfb5f95d4054a7a (diff) | |
| download | bcm5719-llvm-474251577163d262d4907466f8c3688b1aeea5c6.tar.gz bcm5719-llvm-474251577163d262d4907466f8c3688b1aeea5c6.zip | |
Clang part of r69947. Reverting back 69574 as it is no longer needed.
llvm-svn: 69949
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 77771bd937a..308a45e4335 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -958,14 +958,10 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { } unsigned Width = cast<llvm::IntegerType>(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<llvm::IntegerType>(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 |

