luken-google created this revision. Herald added a project: All. luken-google requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Fixes GH#53983. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D141690 Files: clang/lib/CodeGen/CGCall.cpp Index: clang/lib/CodeGen/CGCall.cpp =================================================================== --- clang/lib/CodeGen/CGCall.cpp +++ clang/lib/CodeGen/CGCall.cpp @@ -1334,7 +1334,8 @@ void CodeGenFunction::EmitAggregateStore(llvm::Value *Val, Address Dest, bool DestIsVolatile) { // Prefer scalar stores to first-class aggregate stores. - if (llvm::StructType *STy = dyn_cast<llvm::StructType>(Val->getType())) { + llvm::StructType *STy = dyn_cast<llvm::StructType>(Val->getType()); + if (STy && STy->isLayoutIdentical(cast<llvm::StructType>(Dest.getElementType()))) { for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { Address EltPtr = Builder.CreateStructGEP(Dest, i); llvm::Value *Elt = Builder.CreateExtractValue(Val, i);
Index: clang/lib/CodeGen/CGCall.cpp =================================================================== --- clang/lib/CodeGen/CGCall.cpp +++ clang/lib/CodeGen/CGCall.cpp @@ -1334,7 +1334,8 @@ void CodeGenFunction::EmitAggregateStore(llvm::Value *Val, Address Dest, bool DestIsVolatile) { // Prefer scalar stores to first-class aggregate stores. - if (llvm::StructType *STy = dyn_cast<llvm::StructType>(Val->getType())) { + llvm::StructType *STy = dyn_cast<llvm::StructType>(Val->getType()); + if (STy && STy->isLayoutIdentical(cast<llvm::StructType>(Dest.getElementType()))) { for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { Address EltPtr = Builder.CreateStructGEP(Dest, i); llvm::Value *Elt = Builder.CreateExtractValue(Val, i);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits