[PATCH] D98564: [AArch64] Peephole rule to remove redundant cmp after cset.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 15 01:34:20 PDT 2021


dmgreen accepted this revision.
dmgreen added a comment.
This revision is now accepted and ready to land.

I think I managed to convince myself that this is correct. But there is a lot that could go wrong and subtly forgotten, this code has been a bit error prone in the past. Hopefully now that it's gained some infrastructure that's less likely.

LGTM, but please wait a couple of days in case @paquette has more comments.



================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:1752
+                                 bool &IsInvertCC) {
+  assert(CmpValue == 0 || CmpValue == 1);
+
----------------
Add a message for the assert?


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:1855
+  CmpInstr.eraseFromParent();
+  if (IsInvertCC)
+    // Invert condition codes in CmpInstr CC users
----------------
I would leave brackets on statements like this, if the inner part is fairly big.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98564/new/

https://reviews.llvm.org/D98564



More information about the llvm-commits mailing list