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

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 14 10:00:03 PST 2024


Author: Shilei Tian
Date: 2024-02-14T12:59:59-05:00
New Revision: 630f82ec0c61b772711355fad08ed0d0adce922d

URL: https://github.com/llvm/llvm-project/commit/630f82ec0c61b772711355fad08ed0d0adce922d
DIFF: https://github.com/llvm/llvm-project/commit/630f82ec0c61b772711355fad08ed0d0adce922d.diff

LOG: [Clang][CodeGen] Loose the cast check when emitting builtins (#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.

Added: 
    

Modified: 
    clang/lib/CodeGen/CGBuiltin.cpp

Removed: 
    


################################################################################
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())


        


More information about the cfe-commits mailing list