[llvm-commits] [llvm] r69574 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Duncan Sands baldrick at free.fr
Mon Apr 20 00:33:39 PDT 2009


Hi Sanjiv,

> Before trying to introduce/eliminate cast/ext/trunc to make indices type as
> pointer type, make sure that the pointer size is a valid sequential index type.

what's this about?  Got a testcase?

Ciao,

Duncan.

> 
> Modified:
>     llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> 
> Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=69574&r1=69573&r2=69574&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 20 01:05:54 2009
> @@ -10695,7 +10695,12 @@
>    gep_type_iterator GTI = gep_type_begin(GEP);
>    for (User::op_iterator i = GEP.op_begin() + 1, e = GEP.op_end();
>         i != e; ++i, ++GTI) {
> -    if (isa<SequentialType>(*GTI)) {
> +    // Before trying to eliminate/introduce cast/ext/trunc to make
> +    // indices as pointer types, make sure that the pointer size
> +    // makes a valid sequential index.
> +    const SequentialType *ST = dyn_cast<SequentialType>(*GTI);
> +    Value *PtrTypeVal = Constant::getNullValue(TD->getIntPtrType());
> +    if (ST && ST->indexValid(PtrTypeVal)) {
>        if (CastInst *CI = dyn_cast<CastInst>(*i)) {
>          if (CI->getOpcode() == Instruction::ZExt ||
>              CI->getOpcode() == Instruction::SExt) {
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 




More information about the llvm-commits mailing list