Displaying 20 results from an estimated 20000 matches similar to: "RFC: Killing undef and spreading poison"
2017 Jun 07
2
RFC: Killing undef and spreading poison
Since most add/sub operations compiled from C have the nsw attribute, we
cannot simply restrict movement of these instructions.
Sure, we could drop nsw when moving these instructions, but there are still
many other problems left. Please read more about the topic here:
https://blog.regehr.org/archives/1496
For example, doing loop unswitching, followed by inline (just to illustrate
that the
2016 Nov 11
2
RFC: Killing undef and spreading poison
Hi John,
John McCall wrote:
>> On Nov 10, 2016, at 10:37 PM, Sanjoy Das<sanjoy at playingwithpointers.com> wrote:
>> As a concrete example, say we have:
>>
>> i32 sum = x *nsw y
>> i64 sum.sext = sext sum to i64
>> ...
>> some use of sum.sext
>>
>>
>> Pretending "x +nsw 1" does not sign-overflow, we can commute the sext
2016 Nov 11
3
RFC: Killing undef and spreading poison
Hi John,
John McCall wrote:
>>> Well, we could say non-nsw add and mul are actually "bitwise" operations, so "mul i32 poison, 2" is guaranteed to have its bottom bit zero (but "mul nsw i32 poison, 2" is poison). Of course, there's a limit to how far we can go in that direction, or we just end up with the old notion of undef. Off the top of my head,
2017 Jul 03
2
trunc nsw/nuw?
Hello,
>From [1], trunc does not seems to have a nsw/nuw attribute.
Is it possible to have that? Or do we have that and it is not up-to-date?
The definition would be:
If the nuw keyword is present, the result value of the trunc is a poison
value if the truncated high order bits are non-zero. If the nsw keyword is
present, the result value of the trunc is a poison value if the truncated
high
2011 Dec 12
5
[LLVMdev] nsw is still logically inconsistent
The recent discussion of nsw led me to go back and review the
current definition of nsw in greater depth, and it turns out that
even with all the theoretical effort, it's still logically
inconsistent.
First, a warning: The scenario below is artificial. This is just
a demonstration. Also, ignore the fact that instcombine would zap
everything. Depending on that would be an implicit pass
2017 Jul 04
4
trunc nsw/nuw?
Hi,
> Hi Alexandre,
>
> LLVM currently doesn't have trunc nsw/nuw, no.
> Which frontend would emit such instructions? Any application in mind?
> Just asking because if no frontend could emit those, then the motivation to
> add nsw/nuw support to trunc would be very low I guess.
I think the clang frontend could use that to allow better static analysis of integer overflows
on
2016 Nov 09
4
RFC: Killing undef and spreading poison
> On 11/8/2016 3:32 PM, Sanjoy Das wrote:
>> Hi Nuno, Chandler,
>>
>> Nuno Lopes via llvm-dev wrote:
>> > This program stores 8 bits, and leaves the remaining 24 bits
>> > uninitialized. It then loads 16 bits, half initialized to %v, half
>> > uninitialized. SROA transforms the above function to:
>> >
>> > define i16 @g(i8 %in) {
2017 Jul 07
3
trunc nsw/nuw?
Hi,
Even if there are no ways in which a *frontend* can produce nsw
truncs, it may still be useful to have if optimization passes can
usefully attach nsw to truncates (after proving the truncates don't
"overflow"). For instance in
%a = ashr i64 %v, i32 33
%t = trunc %a to i32
the trunc can be marked nsw.
However, the burden of proof here is to show that we can do some
useful
2017 Jul 05
2
trunc nsw/nuw?
On Wed, Jul 5, 2017 at 3:59 PM, Hal Finkel via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
>
> On 07/04/2017 01:41 AM, Dr.-Ing. Christoph Cullmann via llvm-dev wrote:
>
>> Hi,
>>
>> Hi Alexandre,
>>>
>>> LLVM currently doesn't have trunc nsw/nuw, no.
>>> Which frontend would emit such instructions? Any application in mind?
2016 Oct 21
4
RFC: Killing undef and spreading poison
Hi Dan,
Thanks a lot for the feedback and apologies for the delay!
>> br poison -> UB
> What impact does this have on API contracts? Some library functions might currently tolerate being passed an uninitialized value (at the LLVM level; C's semantics are different). However, with the new poison, if the implementation of a function happens to do a branch on the input, the code has
2011 Dec 14
2
[LLVMdev] nsw is still logically inconsistent
2011/12/14 Rafael Ávila de Espíndola <rafael.espindola at gmail.com>:
>> We first perform a speculation transformation, hoisting all of the
>> code above the %overflow_check branch:
>>
>> %t0 = add nsw i32 %a, %b
>> %t1 = sext i32 %t0 to i64
>> %t2 = ashr i64 %t1, 31
>> %t3 = add i64 %t2, 1
>> %t5 = icmp ult %t3, 2
>> %t6 =
2017 Jul 06
2
trunc nsw/nuw?
According to 6.3.1.3/3 of the C standard (I didn't check C++):
"3 Otherwise, the new type is signed and the value cannot be represented
in it; either the result is implementation-defined or an
implementation-defined signal is raised."
I *think* that means that IF a signal is raised then the signal raised
could be one that you can't guarantee to be able to return from
2017 Jul 05
3
trunc nsw/nuw?
On 07/05/2017 03:10 PM, Alexandre Isoard wrote:
> Ah, ok. I read it wrong. In *neither* case it is UB.
>
> Hum, can an implementation define it as UB? :-)
Nope :-)
The only case I've thought of where we could add these for C++ would be
on conversions to (most) enums (because they used signed underlying
types and the out-of-bounds mapping won't generally be one of the
allowed
2011 Dec 14
0
[LLVMdev] nsw is still logically inconsistent
> We first perform a speculation transformation, hoisting all of the
> code above the %overflow_check branch:
>
> %t0 = add nsw i32 %a, %b
> %t1 = sext i32 %t0 to i64
> %t2 = ashr i64 %t1, 31
> %t3 = add i64 %t2, 1
> %t5 = icmp ult %t3, 2
> %t6 = udiv i1 1, %t5
> br i1 %overflow_check, label %no_overflow, label %end
>
> no_overflow:
>
>
2017 Jun 08
7
RFC: Killing undef and spreading poison
Hi Peter,
On Thu, Jun 8, 2017 at 9:41 AM, Peter Lawrence
<peterl95124 at sbcglobal.net> wrote:
>
>> On Jun 7, 2017, at 2:23 PM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>>
>> Since most add/sub operations compiled from C have the nsw attribute, we cannot simply restrict movement of these instructions.
>
> Nuno,
> I’m not saying the operations
2011 Dec 15
0
[LLVMdev] nsw is still logically inconsistent
On Dec 14, 2011, at 12:11 PM, Eli Friedman wrote:
> 2011/12/14 Rafael Ávila de Espíndola <rafael.espindola at gmail.com>:
>>> We first perform a speculation transformation, hoisting all of the
>>> code above the %overflow_check branch:
>>>
>>> %t0 = add nsw i32 %a, %b
>>> %t1 = sext i32 %t0 to i64
>>> %t2 = ashr i64 %t1, 31
2016 Oct 20
2
RFC: Killing undef and spreading poison
Hi Alexandre,
On Wed, Oct 19, 2016 at 6:27 PM, Alexandre Isoard
<alexandre.isoard at gmail.com> wrote:
> Really interesting read. I am perplexed now, and am not even sure what is
> the meaning of undef anymore.
Welcome aboard. :)
> Example (unrelated to your blog post, but still weird):
> %x = sext i1 undef to i2
>
> I understand that I can replace it by either of:
>
2015 Apr 01
2
[LLVMdev] Cast to SCEVAddRecExpr
Thanks Sanjoy.
> To be pedantic, "var[i<<1]" is not an add recurrence, but "&var[i <<
> 1]" is an add recurrence. I'll assume that's that you meant.
Yes, I meant the same.
> I think that is because in C, multiplication is nsw but left shift is
> not and so "i << 1" can legitimately sign-overflow but i * 2 cannot
>
2016 Oct 20
2
RFC: Killing undef and spreading poison
Hi Mehdi,
On Wed, Oct 19, 2016 at 8:29 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
>> sext(x):
>> t = zext x
>> result = 0
>> for i = 0 to bitwidth:
>> result |= t << i;
>> return result
>
> I don’t understand this definition of sext?
> Are you trying to express that we will copy the sign one bit at a time, and so every `new`
2015 Jun 11
4
[LLVMdev] Question about NoWrap flag for SCEVAddRecExpr
[+Arnold]
> On Jun 10, 2015, at 1:29 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
>
> [+CC Andy]
>
>> Can anyone familiar with ScalarRevolution tell me whether this is an
>> expected behavior or a bug?
>
> Assuming you're talking about 2*k, this is a bug. ScalarEvolution
> should be able to prove that {0,+,4} is <nsw> and