[llvm-dev] Little explanation of this behaviour

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 14 17:36:14 PDT 2016


On 14 April 2016 at 16:23, Lorenzo Laneve <lore97drk at icloud.com> wrote:
> Thanks, so what’s the point of these rules? Do they grant something like safety or faster execution?

My guess is just backwards compatibility from the earliest C compilers
(where it might even have been simply to make implementation easier).
There's certainly no real safety benefits.

I suppose it does tend to match how the instructions actually get
implemented (most backends will use an 32-bit addition even for an
incoming "add i8 %l, %r") so exposing that early might give more
optimization opportunities, but that's a bit tenuous.

> Are you saying that instruction will be optimized by LLVM in this case?

Yes. LLVM will convert the "%int32 = sext i8 %val to i32; %res =
sitofp i32 %int32 to double" sequence into "%res = sitofp i8 %val to
double".

Cheers.

Tim.


More information about the llvm-dev mailing list