From 15474d769110139f9cc96d42434988d7aaa77634 Mon Sep 17 00:00:00 2001 From: David Sherwood Date: Wed, 30 Sep 2020 14:18:03 +0100 Subject: [PATCH] [SVE][CodeGen] Replace use of TypeSize operator< in GlobalMerge::doMerge We don't support global variables with scalable vector types so I've changed the code to compare the fixed sizes instead. Differential Revision: https://reviews.llvm.org/D88564 --- llvm/lib/CodeGen/GlobalMerge.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp index 1e20c02..6c1ce4c 100644 --- a/llvm/lib/CodeGen/GlobalMerge.cpp +++ b/llvm/lib/CodeGen/GlobalMerge.cpp @@ -223,8 +223,9 @@ bool GlobalMerge::doMerge(SmallVectorImpl &Globals, // FIXME: Find better heuristics llvm::stable_sort( Globals, [&DL](const GlobalVariable *GV1, const GlobalVariable *GV2) { - return DL.getTypeAllocSize(GV1->getValueType()) < - DL.getTypeAllocSize(GV2->getValueType()); + // We don't support scalable global variables. + return DL.getTypeAllocSize(GV1->getValueType()).getFixedSize() < + DL.getTypeAllocSize(GV2->getValueType()).getFixedSize(); }); // If we want to just blindly group all globals together, do so. -- 2.7.4