[clang] [Clang] Fix a non-effective assertion (PR #81083)

Shilei Tian via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 19:37:42 PST 2024


https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/81083

`PTy` here is literally `FTy->getParamType(i)`, which makes this assertion not
work as expected.


>From 076e6d3e1f5a88c4c54b0d2bf6932c9d9ae33678 Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Wed, 7 Feb 2024 22:35:28 -0500
Subject: [PATCH] [Clang] Fix a non-effective assertion

`PTy` here is literally `FTy->getParamType(i)`, which makes this assertion not
work as expected.
---
 clang/lib/CodeGen/CGBuiltin.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index e051cbc6486353..a7a410dab1a018 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -5908,7 +5908,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
           }
         }
 
-        assert(PTy->canLosslesslyBitCastTo(FTy->getParamType(i)) &&
+        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.



More information about the cfe-commits mailing list