[clang] [CGBuiltin] Use freeze instruction to create an undef value instead of zero (PR #86967)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 29 12:11:18 PDT 2024
https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/86967
>From 5d8873d4c296a839674f4ad1a51c779df9c68fab Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at 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
Revert "[CGBuiltin] Use freeze instruction to create an undef value instead of zero"
This reverts commit 2cbc890e5d2296105cf9f3eb350181e1c9f0ed2d.
[X86] Pre-commit tests (NFC)
---
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 287e763bad82dd..3c62d94bb9d842 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -14398,11 +14398,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:
More information about the cfe-commits
mailing list