diff options
author | Chris Lattner <sabre@nondot.org> | 2008-03-19 05:19:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-03-19 05:19:41 +0000 |
commit | 36b6a0a63e87803a85080c639ad8b61e8bb5f9ee (patch) | |
tree | 7bf236cc8f479fc39ebee8e8a9cf31f7e160de5c /lib/CodeGen/CGExprScalar.cpp | |
parent | d6c1360c2bf234c73572a865f119d0518aca8154 (diff) |
simplify the clang codegen by using the new Builder.CreateStructGEP method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48534 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 892712a0d4..2d42f8f812 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -524,10 +524,7 @@ Value *ScalarExprEmitter::VisitImplicitCastExpr(const ImplicitCastExpr *E) { isa<llvm::ArrayType>(cast<llvm::PointerType>(V->getType()) ->getElementType()) && "Doesn't support VLAs yet!"); - llvm::Constant *Idx0 = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0); - - llvm::Value *Ops[] = {Idx0, Idx0}; - V = Builder.CreateGEP(V, Ops, Ops+2, "arraydecay"); + V = Builder.CreateStructGEP(V, 0, "arraydecay"); // The resultant pointer type can be implicitly casted to other pointer // types as well, for example void*. @@ -597,7 +594,7 @@ Value *ScalarExprEmitter::VisitPrePostIncDec(const UnaryOperator *E, if (isa<llvm::PointerType>(InVal->getType())) { // FIXME: This isn't right for VLAs. NextVal = llvm::ConstantInt::get(llvm::Type::Int32Ty, AmountVal); - NextVal = Builder.CreateGEP(InVal, NextVal); + NextVal = Builder.CreateGEP(InVal, NextVal, "ptrincdec"); } else { // Add the inc/dec to the real part. if (isa<llvm::IntegerType>(InVal->getType())) |