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
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 892712a..2d42f8f 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -524,10 +524,7 @@
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 @@
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()))