[PATCH] Fixing a corner-case bug in lib call optimization

Gao, Yunzhong yunzhong_gao at playstation.sony.com
Tue Aug 13 14:03:04 PDT 2013


Hi Nick,
Thanks for reviewing the patch.
I will change the type conversion to "unsigned char" instead; that should make
the result deterministic.
I feel that this is probably still not an ideal solution because the host machine
might have a different size for "char" type than the target machine, but in the
llvm backend I did not find a way to extract the size of target "char" type. I
would guess that machines with non-8-bit bytes are rare nowadays? Since
the patch is only intended for a corner-case comparing a value with zero, it
might suffice using a cast to "unsigned char" or even "(value & 255)".
What do you think?
- Gao.

________________________________________
From: Nick Lewycky [nicholas at mxc.ca]
Sent: Monday, August 12, 2013 11:09 AM
To: reviews+D1279+public+b2efa1ad64fbca2e at llvm-reviews.chandlerc.com
Cc: Gao, Yunzhong; llvm-commits at cs.uiuc.edu
Subject: Re: [PATCH] Fixing a corner-case bug in lib call optimization

Yunzhong Gao wrote:
>
>    ping.
>    Does this patch look good to go in?
>
> http://llvm-reviews.chandlerc.com/D1279

If the value doesn't fit into a 'char', the result of the conversion to
char will be implementation-defined. Could you please make it something
that is guaranteed to be deterministic?

Nick





More information about the llvm-commits mailing list