OSDN Git Service

Create ConstantExpr GEPs the correct way. This fixes
authorDan Gohman <gohman@apple.com>
Tue, 19 May 2009 19:18:01 +0000 (19:18 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 19 May 2009 19:18:01 +0000 (19:18 +0000)
MultiSource/Benchmarks/Prolangs-C/football and a variety of other
failures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72120 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolutionExpander.cpp

index 36b6206..d110385 100644 (file)
@@ -246,7 +246,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEVAddExpr *S,
     // Fold a GEP with constant operands.
     if (Constant *CLHS = dyn_cast<Constant>(V))
       if (Constant *CRHS = dyn_cast<Constant>(Idx))
-        return ConstantExpr::get(Instruction::GetElementPtr, CLHS, CRHS);
+        return ConstantExpr::getGetElementPtr(CLHS, &CRHS, 1);
 
     // Do a quick scan to see if we have this GEP nearby.  If so, reuse it.
     unsigned ScanLimit = 6;