From 1cdacfc6966d425a99f3f23e9b4350eae71df32f Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 14 Jan 2016 20:28:25 +0000 Subject: [PATCH] Assert that a cmp function defines a total order. Thanks to David Blaikie for noticing it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257796 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp b/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp index 3b702fe4bee..8e6603c5559 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp @@ -334,9 +334,8 @@ static int cmpRel(const ELFRelocationEntry *AP, const ELFRelocationEntry *BP) { const ELFRelocationEntry &B = *BP; if (A.Offset != B.Offset) return B.Offset - A.Offset; - if (B.Type != A.Type) - return A.Type - B.Type; - return 0; + assert(B.Type != A.Type && "We don't have a total order"); + return A.Type - B.Type; } void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm, -- 2.11.0