Use lengthIs and friends in more places
While investigating #12545, I discovered several places in the code that performed length-checks like so: ``` length ts == 4 ``` This is not ideal, since the length of `ts` could be much longer than 4, and we'd be doing way more work than necessary! There are already a slew of helper functions in `Util` such as `lengthIs` that are designed to do this efficiently, so I found every place where they ought to be used and did just that. I also defined a couple more utility functions for list length that were common patterns (e.g., `ltLength`). Test Plan: ./validate Reviewers: austin, hvr, goldfire, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: goldfire, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3622
Showing
- compiler/basicTypes/DataCon.hs 2 additions, 2 deletionscompiler/basicTypes/DataCon.hs
- compiler/basicTypes/Demand.hs 4 additions, 4 deletionscompiler/basicTypes/Demand.hs
- compiler/basicTypes/MkId.hs 1 addition, 1 deletioncompiler/basicTypes/MkId.hs
- compiler/basicTypes/PatSyn.hs 2 additions, 2 deletionscompiler/basicTypes/PatSyn.hs
- compiler/cmm/CmmBuildInfoTables.hs 1 addition, 1 deletioncompiler/cmm/CmmBuildInfoTables.hs
- compiler/cmm/CmmContFlowOpt.hs 2 additions, 1 deletioncompiler/cmm/CmmContFlowOpt.hs
- compiler/codeGen/StgCmmClosure.hs 1 addition, 1 deletioncompiler/codeGen/StgCmmClosure.hs
- compiler/codeGen/StgCmmExpr.hs 1 addition, 1 deletioncompiler/codeGen/StgCmmExpr.hs
- compiler/codeGen/StgCmmLayout.hs 1 addition, 1 deletioncompiler/codeGen/StgCmmLayout.hs
- compiler/codeGen/StgCmmPrim.hs 2 additions, 2 deletionscompiler/codeGen/StgCmmPrim.hs
- compiler/codeGen/StgCmmTicky.hs 3 additions, 2 deletionscompiler/codeGen/StgCmmTicky.hs
- compiler/coreSyn/CoreLint.hs 6 additions, 6 deletionscompiler/coreSyn/CoreLint.hs
- compiler/coreSyn/CoreUnfold.hs 2 additions, 2 deletionscompiler/coreSyn/CoreUnfold.hs
- compiler/coreSyn/CoreUtils.hs 4 additions, 4 deletionscompiler/coreSyn/CoreUtils.hs
- compiler/coreSyn/TrieMap.hs 2 additions, 1 deletioncompiler/coreSyn/TrieMap.hs
- compiler/deSugar/Check.hs 4 additions, 8 deletionscompiler/deSugar/Check.hs
- compiler/deSugar/Coverage.hs 1 addition, 1 deletioncompiler/deSugar/Coverage.hs
- compiler/deSugar/DsExpr.hs 2 additions, 2 deletionscompiler/deSugar/DsExpr.hs
- compiler/deSugar/MatchCon.hs 1 addition, 1 deletioncompiler/deSugar/MatchCon.hs
- compiler/ghci/ByteCodeGen.hs 2 additions, 2 deletionscompiler/ghci/ByteCodeGen.hs
Loading
Please register or sign in to comment