From 9669b0a15e306df8c65dd39eb04b233bd5519f8c Mon Sep 17 00:00:00 2001 From: Mark Peerdeman Date: Tue, 27 Feb 2024 09:53:22 +0100 Subject: [PATCH] Fix regression to collapsing literal structs A regression to collapsing literal structs was introduced in commit 5745eea55d666b04c90859205ae1dbf05f60bbfe. Literal structs can always be collapsed into parent structs, since the parent cannot be literal aswell. --- llvm/lib/CheerpUtils/TypeOptimizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/CheerpUtils/TypeOptimizer.cpp b/llvm/lib/CheerpUtils/TypeOptimizer.cpp index 42d803eced60..562a91211d0d 100644 --- a/llvm/lib/CheerpUtils/TypeOptimizer.cpp +++ b/llvm/lib/CheerpUtils/TypeOptimizer.cpp @@ -292,7 +292,7 @@ bool TypeOptimizer::canCollapseStruct(llvm::StructType* st, llvm::StructType* ne if (newStruct == nullptr) { assert(st->isLiteral()); - return false; + return true; } // Stop if the element is just a int8, we may be dealing with an empty struct // Empty structs are unsafe as the int8 inside is just a placeholder and will be replaced