[llvm-commits] [llvm] r151055 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineCompares.cpp test/Transforms/InstCombine/icmp.ll

Duncan Sands baldrick at free.fr
Tue Feb 21 05:38:27 PST 2012


Hi Benjamin,

> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Tue Feb 21 07:31:09 2012
> @@ -571,6 +571,14 @@
>   Instruction *InstCombiner::FoldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
>                                          ICmpInst::Predicate Cond,
>                                          Instruction&I) {
> +  // Don't transform signed compares of GEPs into index compares. Even if the
> +  // GEP is inbounds, the final add of the base pointer can have signed overflow
> +  // and would change the result of the icmp.
> +  // e.g. "&foo[0]<s&foo[1]" can't be folded to "true" because "foo" could be
> +  // the minimum signed value for the pointer type.

I just this should be: the maximum signed value.

Ciao, Duncan.



More information about the llvm-commits mailing list