[cfe-commits] r69949 - in /cfe/trunk/lib/CodeGen: CGExpr.cpp CGExprScalar.cpp
Sanjiv Gupta
sanjiv.gupta at microchip.com
Thu Apr 23 19:40:57 PDT 2009
Author: sgupta
Date: Thu Apr 23 21:40:57 2009
New Revision: 69949
URL: http://llvm.org/viewvc/llvm-project?rev=69949&view=rev
Log:
Clang part of r69947. Reverting back 69574 as it is no longer needed.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=69949&r1=69948&r2=69949&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Apr 23 21:40:57 2009
@@ -805,11 +805,8 @@
QualType IdxTy = E->getIdx()->getType();
bool IdxSigned = IdxTy->isSignedIntegerType();
unsigned IdxBitwidth = cast<llvm::IntegerType>(Idx->getType())->getBitWidth();
-
- // If Pointer width is less than 32 than extend to 32.
- unsigned IdxValidWidth = (LLVMPointerWidth < 32 ) ? 32 : LLVMPointerWidth;
- if (IdxBitwidth != IdxValidWidth)
- Idx = Builder.CreateIntCast(Idx, llvm::IntegerType::get(IdxValidWidth),
+ if (IdxBitwidth != LLVMPointerWidth)
+ Idx = Builder.CreateIntCast(Idx, llvm::IntegerType::get(LLVMPointerWidth),
IdxSigned, "idxprom");
// We know that the pointer points to a type of the correct size, unless the
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=69949&r1=69948&r2=69949&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Thu Apr 23 21:40:57 2009
@@ -958,14 +958,10 @@
}
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 @@
// 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
More information about the cfe-commits
mailing list