https://github.com/hstk30-hw created https://github.com/llvm/llvm-project/pull/159349
A || (!A && B) => A || B >From f7202f6b86a6929e850f46a1f3c801d09d984519 Mon Sep 17 00:00:00 2001 From: hstk30-hw <hanwe...@huawei.com> Date: Wed, 17 Sep 2025 20:39:29 +0800 Subject: [PATCH] [NFC] Remove redundant conditions A || (!A && B) => A || B --- clang/lib/CodeGen/CGDecl.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 29193e0c541b9..4e735f6d28f34 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1251,8 +1251,7 @@ void CodeGenFunction::emitStoresForConstant(const VarDecl &D, Address Loc, LangOptions::TrivialAutoVarInitKind::Pattern; if (shouldSplitConstantStore(CGM, ConstantSize)) { if (auto *STy = dyn_cast<llvm::StructType>(Ty)) { - if (STy == Loc.getElementType() || - (STy != Loc.getElementType() && IsTrivialAutoVarInitPattern)) { + if (STy == Loc.getElementType() || IsTrivialAutoVarInitPattern) { const llvm::StructLayout *Layout = CGM.getDataLayout().getStructLayout(STy); for (unsigned i = 0; i != constant->getNumOperands(); i++) { @@ -1266,8 +1265,7 @@ void CodeGenFunction::emitStoresForConstant(const VarDecl &D, Address Loc, return; } } else if (auto *ATy = dyn_cast<llvm::ArrayType>(Ty)) { - if (ATy == Loc.getElementType() || - (ATy != Loc.getElementType() && IsTrivialAutoVarInitPattern)) { + if (ATy == Loc.getElementType() || IsTrivialAutoVarInitPattern) { for (unsigned i = 0; i != ATy->getNumElements(); i++) { Address EltPtr = Builder.CreateConstGEP( Loc.withElementType(ATy->getElementType()), i); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits