[SVE][CodeGen] Replace use of TypeSize operator< in GlobalMerge::doMerge
authorDavid Sherwood <david.sherwood@arm.com>
Wed, 30 Sep 2020 13:18:03 +0000 (14:18 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Thu, 1 Oct 2020 13:06:59 +0000 (14:06 +0100)
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

index 1e20c02..6c1ce4c 100644 (file)
@@ -223,8 +223,9 @@ bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &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.