[PATCH] D119967: [InstCombineCalls] Optimize call of bitcast even w/ parameter attributes

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 22 07:59:15 PST 2022


jdoerfert added a comment.

In D119967#3336985 <https://reviews.llvm.org/D119967#3336985>, @nikic wrote:

> In D119967#3327289 <https://reviews.llvm.org/D119967#3327289>, @jdoerfert wrote:
>
>> In D119967#3327278 <https://reviews.llvm.org/D119967#3327278>, @nikic wrote:
>>
>>> I'm not convinced this is right when there are ABI affecting attributes involved. Consider the first example, where `zeroext` is dropped. Let's hypothetically assume that this indicates a zeroext up to 64-bit, but we have 32-bit pointers. Doing the transform and dropping the zeroext means that the top bits will be left uninitialized now.
>>
>> I don't think zeroext is a problem. The 64 bit case shows why, `isBitOrNoopPointerCastable` is false and we won't transform it.
>
> I'm referring to the case where the argument is pointer-sized (so it is castable), but the (target-specific) semantics of `zeroext` require an extension beyond pointer size.

So you are saying it is legal and expected that we extend the argument even though the callee expects a pointer (of smaller size)? (How is that not UB?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119967



More information about the llvm-commits mailing list