https://github.com/AtariDreams created https://github.com/llvm/llvm-project/pull/86967
None >From 74c168b790f8daabf68426ce3fdffee0348f126b Mon Sep 17 00:00:00 2001 From: Rose <gfunni...@gmail.com> Date: Thu, 28 Mar 2024 12:12:57 -0400 Subject: [PATCH] [CGBuiltin] Use freeze instruction to create an undef value instead of zero --- clang/lib/CodeGen/CGBuiltin.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 5ab5917c0c8da7..179c0cf3cc905a 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -14305,11 +14305,9 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, case X86::BI__builtin_ia32_undef256: case X86::BI__builtin_ia32_undef512: // The x86 definition of "undef" is not the same as the LLVM definition - // (PR32176). We leave optimizing away an unnecessary zero constant to the - // IR optimizer and backend. - // TODO: If we had a "freeze" IR instruction to generate a fixed undef - // value, we should use that here instead of a zero. - return llvm::Constant::getNullValue(ConvertType(E->getType())); + // (PR32176). Use a "freeze" IR instruction to generate a fixed undef + // value. + return Builder.CreateFreeze(UndefValue::get(ConvertType(E->getType()))); case X86::BI__builtin_ia32_vec_init_v8qi: case X86::BI__builtin_ia32_vec_init_v4hi: case X86::BI__builtin_ia32_vec_init_v2si: _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits