From a3732ee4d3b54b47c3319bb8ecfbed5c83975340 Mon Sep 17 00:00:00 2001 From: Hyxogen <8938732+Hyxogen@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:20:40 +0100 Subject: [PATCH] globalopt: propagate section to optimized global --- llvm/lib/Transforms/IPO/GlobalOpt.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 7e0e24e7b0d7..561b9eb5d752 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -920,6 +920,9 @@ OptimizeGlobalAddressOfAllocation(GlobalVariable *GV, CallInst *CI, ConstantInt::getFalse(GV->getContext()), GV->getName()+".init", GV->getThreadLocalMode()); bool InitBoolUsed = false; + // CHEERP: this is needed to propagate the "asmjs" section. It is probably + // a good idea in general, so we will do it for any section. + InitBool->setSection(NewGV->getSection()); // Loop over all instruction uses of GV, processing them in turn. SmallVector Guses;