[lld] r288419 - Add an assert instead of ignoring an impossible condition.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 1 13:41:07 PST 2016
Author: ruiu
Date: Thu Dec 1 15:41:06 2016
New Revision: 288419
URL: http://llvm.org/viewvc/llvm-project?rev=288419&view=rev
Log:
Add an assert instead of ignoring an impossible condition.
Modified:
lld/trunk/ELF/ICF.cpp
Modified: lld/trunk/ELF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.cpp?rev=288419&r1=288418&r2=288419&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Thu Dec 1 15:41:06 2016
@@ -243,8 +243,6 @@ bool ICF<ELFT>::variableEq(const InputSe
auto *Y = dyn_cast<InputSection<ELFT>>(DB->Section);
if (!X || !Y)
return false;
- if (X->Color[Cnt % 2] == 0)
- return false;
// Performance hack for single-thread. If no other threads are
// running, we can safely read next colors as there is no race
@@ -252,6 +250,11 @@ bool ICF<ELFT>::variableEq(const InputSe
// iterations of the main loop because we can see results of the
// same iteration.
size_t Idx = (Config->Threads ? Cnt : Cnt + 1) % 2;
+
+ // All colorable sections must have some colors.
+ // 0 is a default non-color value.
+ assert(X->Color[Idx] != 0 && Y->Color[Idx] != 0);
+
return X->Color[Idx] == Y->Color[Idx];
};
More information about the llvm-commits
mailing list