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

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 13:43:40 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-clang

Author: Shilei Tian (shiltian)

<details>
<summary>Changes</summary>

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: https://github.com/llvm/llvm-project/pull/81669.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGBuiltin.cpp (-4) 


``````````diff
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index ee0b7504769622..9bc60466d09be6 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5912,8 +5912,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
           }
         }
 
-        assert(ArgValue->getType()->canLosslesslyBitCastTo(PTy) &&
-               "Must be able to losslessly bit cast to param");
         // Cast vector type (e.g., v256i32) to x86_amx, this only happen
         // in amx intrinsics.
         if (PTy->isX86_AMXTy())
@@ -5943,8 +5941,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
         }
       }
 
-      assert(V->getType()->canLosslesslyBitCastTo(RetTy) &&
-             "Must be able to losslessly bit cast result type");
       // Cast x86_amx to vector type (e.g., v256i32), this only happen
       // in amx intrinsics.
       if (V->getType()->isX86_AMXTy())

``````````

</details>


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


More information about the cfe-commits mailing list