[LLVMdev] Why are imm shifts where imm >= width type eliminated entirely?
Stephen Canon
scanon at apple.com
Mon Apr 20 13:04:08 PDT 2015
> On Apr 20, 2015, at 4:00 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
>
> For example:
>
> unsigned int x, y;
>
> void foo()
> {
> y = x >> 129;
> }
>
> Where int is a 16bit type, the .ll is producing only 'ret void' at O3. At O0 the .ll looks fine but then llc gets rid of it an simply returns.
>
> I'm just curious what the reasoning is for this? It isn't trying to set y to anything at all.
>
> Thanks.
Shifts amounts equal to or larger than the width of the promoted type being shifted are undefined behavior.
– Steve
More information about the llvm-dev
mailing list