aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/GlobalMerge.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-03-18 15:04:36 +0100
committerNikita Popov <npopov@redhat.com>2025-03-18 15:06:39 +0100
commit8f66fb784291c897a965a9ee4c280e314dc8cee4 (patch)
tree187828253e60ab967501d0755770a3d4c1022044 /llvm/lib/CodeGen/GlobalMerge.cpp
parent1bb8b656a9dcdae3863508b8f33bd713e953636d (diff)
downloadllvm-8f66fb784291c897a965a9ee4c280e314dc8cee4.zip
llvm-8f66fb784291c897a965a9ee4c280e314dc8cee4.tar.gz
llvm-8f66fb784291c897a965a9ee4c280e314dc8cee4.tar.bz2
[GlobalMerge] Fix handling of const options
For the NewPM, the merge-const option was assigned to an unused option field. Assign it to the correct one. The merge-const-aggressive option was not supported -- and invalid options were silently ignored. Accept it and error on invalid options. For the LegacyPM, the corresponding cl::opt options were ignored when called via opt rather than llc.
Diffstat (limited to 'llvm/lib/CodeGen/GlobalMerge.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalMerge.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
index 1aedc44..d0918ac 100644
--- a/llvm/lib/CodeGen/GlobalMerge.cpp
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp
@@ -198,6 +198,8 @@ public:
explicit GlobalMerge() : FunctionPass(ID) {
Opt.MaxOffset = GlobalMergeMaxOffset;
+ Opt.MergeConstantGlobals = EnableGlobalMergeOnConst;
+ Opt.MergeConstAggressive = GlobalMergeAllConst;
initializeGlobalMergePass(*PassRegistry::getPassRegistry());
}