[PATCH] [SCEV][LoopVectorize] Allow ScalarEvolution to make assumptions about overflows

Sanjoy Das sanjoy at playingwithpointers.com
Tue Jun 23 01:04:18 PDT 2015


On Tue, Jun 23, 2015 at 12:56 AM, Sanjoy Das
<sanjoy at playingwithpointers.com> wrote:
> I'll make it a point to do a more detailed review this week, but I
> have a high level question:
>
> Instead of a separate AssumingScalarEvolution, why not have an
> interface like:
>
>   NoOverflowResult ScalarEvolution::proveNoOverflow(SCEVAddRecExpr
> *AddRec, FlagType, bool CanAddAssumptions);
>
> NoOverflowResult can be Yes, No or (if CanAddAssumptions is true) a
> predicate that, if satisfied, will guarantee AddRec does not overflow
> in the FlagType sense.  Then the client can choose if it is profitable
> to actually emit the predicate if it is cheap enough relative to expected
> payoff.
>
> A much more general interface could be
>
>  Result ScalarEvolution::provePredicate(CmpInst::Pred, SCEV *LHS, SCEV *RHS)
>
> and have it return one of "Yes | No | Guarded (Predicate)"

In fact "Yes" could be a degenerate case of "Guarded (Predicate)"
where you generate a predicate that just so happens that SCEV can
prove without any help from the client.

-- Sanjoy



More information about the llvm-commits mailing list