[PATCH] D102153: [SelectionDAG] Fix argument copy elision with irregular types

LemonBoy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 02:06:05 PDT 2021


LemonBoy added a comment.

In D102153#2764464 <https://reviews.llvm.org/D102153#2764464>, @rnk wrote:

> I don't see why this optimization should be declared illegal. Why isn't it the caller's responsibility to store these narrow integers canonically? C doesn't have narrow integers, but GCC doesn't do this. If a variable is passed in memory, it just uses the memory that was passed into it.

AFAICS it's the callee's responsibility to chop the extra bits off.
In this <https://gist.github.com/LemonBoy/75b860aabe8c6d4a43c7a983f6702dab> (compile at `-O0`) example you can see that `@expect` is correctly truncating the `i3` value passed in-register, but fails to do so for the third argument that's passed in-memory.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102153/new/

https://reviews.llvm.org/D102153



More information about the llvm-commits mailing list