[PATCH] D45173: [InstCombine] Recognize idioms for ctpop and ctlz

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 7 02:34:42 PDT 2018


lebedev.ri added a comment.

To add to that, i think you should be able to get rid of at least some of the pain of detection
of when instcombine got smarter and these folds no longer match, by adding kind-of end-to-end optimization tests.

I.e. i don't see why you could not add a second run-line so it is something like:

  ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
  ; RUN: opt -aggressive-instcombine -S < %s | FileCheck %s --check-prefixes=PLAIN
  ; RUN: opt -instcombine -aggressive-instcombine -S < %s | FileCheck %s --check-prefixes=POSTINSTCOMBINE

Caveats:

- I'm not sure there is much (any?) precedent for such end-to-end testing in LLVM
- I'm not 100% sure `update_test_checks.py` already supports more than one run-line
- **Whoever adds a instcombine fold that breaks aggressive-instcombine fold, will have to fix aggressive-instcombine fold.** But that is a good thing i suppose :)


Repository:
  rL LLVM

https://reviews.llvm.org/D45173





More information about the llvm-commits mailing list