On Sun, Feb 8, 2015 at 8:38 AM, Hal Finkel <hfinkel at anl.gov> wrote:> > Currently, we might replace: > %cmp = icmp sgt i32 undef, INT_MAX -> i1 false > > According to this proposal, we could replace: > %cmp = icmp sgt i32 undef, INT_MAX -> i1 undef > > While replacing it with false is still allowed, so is replacing it with > true. I'm not sure this makes sense.I think your example is a compelling argument for making icmp more powerful and less obvious when you replace INT_MAX with an unknown variable %a: %cmp = icmp sgt i32 undef, %a We'd like to make %cmp undef without having to prove that %a is not INT_MAX. I'm pretty sure instcombine does something like this today, and this change would provide the basis for it. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150208/844417cc/attachment.html>
----- Original Message -----> From: "Reid Kleckner" <rnk at google.com> > To: "Hal Finkel" <hfinkel at anl.gov> > Cc: "David Majnemer" <david.majnemer at gmail.com>, "Nuno Lopes" <nuno.lopes at ist.utl.pt>, "John Regehr" > <regehr at cs.utah.edu>, "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Sent: Sunday, February 8, 2015 11:47:09 AM > Subject: Re: [LLVMdev] RFC: Proposal to Remove Poison > > On Sun, Feb 8, 2015 at 8:38 AM, Hal Finkel < hfinkel at anl.gov > wrote: > > Currently, we might replace: > %cmp = icmp sgt i32 undef, INT_MAX -> i1 false > > According to this proposal, we could replace: > %cmp = icmp sgt i32 undef, INT_MAX -> i1 undef > > While replacing it with false is still allowed, so is replacing it > with true. I'm not sure this makes sense. > > > I think your example is a compelling argument for making icmp more > powerful and less obvious when you replace INT_MAX with an unknown > variable %a: > > %cmp = icmp sgt i32 undef, %a > > > We'd like to make %cmp undef without having to prove that %a is not > INT_MAX. I'm pretty sure instcombine does something like this today, > and this change would provide the basis for it.When you say, "we'd like to", I'm assuming your justification for this is so that we can model poison using these undef semantics. Is that correct? -Hal -- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory
On Sun, Feb 8, 2015 at 10:02 AM, Hal Finkel <hfinkel at anl.gov> wrote:> > When you say, "we'd like to", I'm assuming your justification for this is > so that we can model poison using these undef semantics. Is that correct? >Yes, but I also think 'icmp sgt i32 undef, %a -> i1 undef' is a pretty reasonable transform by itself. Well-defined programs should never observe the result of the compare. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150208/aea9ddb1/attachment.html>