[clang] [clang] Use different memory layout type for _BitInt(N) in LLVM IR (PR #91364)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 10:51:47 PDT 2024


rjmccall wrote:

> > Okay, so x86_64 describes it in byte terms and says they're little-endian, which is consistent with the overall target. Interestingly, it does not guarantee the content of the excess bits. The code-generation in this patch is consistent with that: the extension we do is unnecessary but allowed, and then we truncate it away after load. If we ever add some way to tell the backend that a truncation is known to be reversing a sign/zero-extension, we'll need to not set it on this target.
> 
> FYI this already exists in the form of `trunc nuw` / `trunc nsw`. (Though it's not fully optimized yet.)

Ah, neat.  Mariya, would you mind looking into setting this properly on the truncates we're doing here?  It'd be fine to do that as a follow-up; no need to hold up this PR for it.  You'll need some kind of target hook to tell us whether to set it or not.  Probably that ought to go in the Basic TargetInfo just so all of the target-specific ABI configuration is done in one place.

https://github.com/llvm/llvm-project/pull/91364


More information about the cfe-commits mailing list