diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-12-01 21:41:06 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-12-01 21:41:06 +0000 |
| commit | a6cd5fe41538a84a7880b167709351a17fd67b22 (patch) | |
| tree | 7571f0826f1d5113ebeef04542619c724ac6e1f3 /lld/ELF/ICF.cpp | |
| parent | 5bb87b6769aaabae141d76ddbf705f2aca566b6c (diff) | |
| download | bcm5719-llvm-a6cd5fe41538a84a7880b167709351a17fd67b22.tar.gz bcm5719-llvm-a6cd5fe41538a84a7880b167709351a17fd67b22.zip | |
Add an assert instead of ignoring an impossible condition.
llvm-svn: 288419
Diffstat (limited to 'lld/ELF/ICF.cpp')
| -rw-r--r-- | lld/ELF/ICF.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp index 0c6ec2f6672..b41660861d3 100644 --- a/lld/ELF/ICF.cpp +++ b/lld/ELF/ICF.cpp @@ -243,8 +243,6 @@ bool ICF<ELFT>::variableEq(const InputSection<ELFT> *A, ArrayRef<RelTy> RelsA, 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 InputSection<ELFT> *A, ArrayRef<RelTy> RelsA, // 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]; }; |

