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

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 19:38:09 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: Shilei Tian (shiltian)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/81083.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+1-1) 


``````````diff
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.

``````````

</details>


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


More information about the cfe-commits mailing list