[PATCH] D18841: [InstCombine] Canonicalize icmp instructions based on dominating conditions.
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 09:53:12 PDT 2016
sanjoy added a comment.
In http://reviews.llvm.org/D18841#412078, @bmakam wrote:
> In http://reviews.llvm.org/D18841#411704, @sanjoy wrote:
>
> > Hi Balaram,
> >
> > I've replied to your inline comment, but it is possible that we're just talking past each other. I'm usually on #llvm as `sanjoyd` on PDT daytime, we can chat there in realtime if you think that'll help.
>
>
> Thanks Sanjoy, sure I will be available on #llvm as `bmakam`. I think I have misinterpreted what you mean by non-singleton RHS. However, I think the current logic as is should be able to generalize to what you define as non-singleton RHS ranges.
>
> > since for "[2, 5)" == 4 and "[3, 5)" == 4 and a == 3, the first program would have called abort() but the new program will call print().
>
> The condition here is u< [2,5) so the allowed range is [0,4) which
> means `a` can never be == 4 for the first/dominating if condition and
> the program will abort() as expected.
I didn't mean to say `a` was `4`. By `"[2, 5)"` == `4` I meant the
RHS we know is in `"[2, 5)"` is `4` (similar for the other time I used
that notation). `a` itself is `3` in the above example.
> If it helps to clarify, I think of the if conditions allowed ranges
> as set A for the dominating if condition and set B for the
> second(`Parent`) if condition. If dominating if condition is true,
> then the second if condition is true iff A ∩ B is true.
As I said in my previous email, the second condition is true //only
if// A ∩ B is true, **not** //iff// A ∩ B is true (follows from the
fact that the second condition is true //only if// B is true).
I.e. the second condition implies A ∩ B but not the other way around.
`makeAllowedICmpRegion` gives you a set with the //only if// property.
`makeSatisfyingICmpRegion` gives you a set with the //if// property.
If they return equal sets, then you have //iff// on that set (or if
you take an intersection of the sets they return).
http://reviews.llvm.org/D18841
More information about the llvm-commits
mailing list