[llvm] [DAGCombiner][AMDGPU] Track signedness in ByteProviders (PR #65995)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 07:51:22 PDT 2023


jayfoad wrote:

> ```
>   %19 = extractelement <4 x i8> %11, i64 1
>   %20 = sext i8 %19 to i16
>   %21 = extractelement <4 x i8> %13, i64 1
>   %22 = zext i8 %21 to i16
>   %23 = mul nsw i16 %22, %20
> ```
> 
> I should say this code looks a bit strange, since we are mixing types (signed / unsigned) in the mul operation. In general, I would think the unsigned type "wins" as this is the spirit of the c++ standard, but, since that was causing failures, I have just disabled the combine in such cases.

This is LLVM IR. It has well defined semantics that have nothing to do with "the spirit of the c++ standard". Whatever your DAG combine does, it needs to preserve the semantics.

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


More information about the llvm-commits mailing list