Using GetElementPtr to traverse large arrays

Hi all,
This question was probably asked million times before, but I wasted
few hours and didn't find the solution..
What is the best way to traverse a large array (say size of million)
with GetElementPtr
The problem with the following code, is that it forces you to create
million constant index values:

intVars = new AllocaInst(Type::getInt32Ty(ctx), allocaSize, "intVars",
someBlock);
for(int i = 0; i < 1000000; i++)
{
   Value *idx = ConstantInt::get(Type::getInt32Ty(ctx), i);
   GetElementPtrInst *gep = GetElementPtrInst::Create(intVars, idx,
"ElemPtr", someBlock);
  new StoreInst(idx, gep, entryBlock); //Store some value in it
}

Apart from the size issue, What is the idiomatic way to traverse small
arrays ? The above loop ? I tried to use CreateInBounds but got
totally confused..

Hi Gabi-

Had you considered simply putting the loop into the IR?

Alastair