[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-14 Thread Shilei Tian via cfe-commits
https://github.com/shiltian closed https://github.com/llvm/llvm-project/pull/81669 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-14 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM (It feels a little weird that the types in the clang AST don't actually match the LLVM builtin, but I guess it's not likely to actually cause any issues.) https://github.com/llvm/llvm-project/pull/81669 _

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-14 Thread Shilei Tian via cfe-commits
shiltian wrote: > Don't see how that could be related; you can losslessly bitconvert between > i16 and bfloat Yes, `canLosslesslyBitCastTo` doesn't allow cast between `i16` and `bfloat`, but it does between two vectors, as long as their sizes are the same. > A cast between float and int sound

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-14 Thread Nikita Popov via cfe-commits
nikic wrote: > I think the right fix is teaching that function about FP <-> INT casts. The documentation for that function says: ``` /// Return true if this type could be converted with a lossless BitCast to /// type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the /// s

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-14 Thread Pierre van Houtryve via cfe-commits
Pierre-vh wrote: > > Sorry, I should have clearly mentioned that. Yes, it is for my followup > > change #80908. In #80908, we changed the type of LLVM builtin but kept the > > corresponding clang builtin unchanged to avoid breaking existing uses. > > Don't see how that could be related; you ca

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-13 Thread Matt Arsenault via cfe-commits
arsenm wrote: > Sorry, I should have clearly mentioned that. Yes, it is for my followup > change #80908. In #80908, we changed the type of LLVM builtin but kept the > corresponding clang builtin unchanged to avoid breaking existing uses. Don't see how that could be related; you can losslessly

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-13 Thread Shilei Tian via cfe-commits
shiltian wrote: > I can't tell what you're trying to fix here. Is this fixing a crash? Or is > the check redundant? Or is it necessary for some followup change you want to > make? Sorry, I should have clearly mentioned that. Yes, it is for my followup change #80908. In #80908, we changed the

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-13 Thread Eli Friedman via cfe-commits
efriedma-quic wrote: I can't tell what you're trying to fix here. Is this fixing a crash? Or is the check redundant? Or is it necessary for some followup change you want to make? https://github.com/llvm/llvm-project/pull/81669 ___ cfe-commits mail

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-13 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: Shilei Tian (shiltian) Changes This patch looses the cast check (`canLosslesslyBitCastTo`) and leaves it to the one inside `CreateBitCast`. It seems too conservative for the use case here. --- Full diff:

[clang] [Clang][CodeGen] Loose the cast check when emitting builtins (PR #81669)

2024-02-13 Thread Shilei Tian via cfe-commits
https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/81669 This patch looses the cast check (`canLosslesslyBitCastTo`) and leaves it to the one inside `CreateBitCast`. It seems too conservative for the use case here. >From 813441fd3106a0069346aabd0dd828d8feb8ea53 Mon S