[PATCH] D124118: [Peephole-Opt] For one kind of test-after-add pattern, eliminates test if it's correct to do so.

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 21:57:42 PDT 2022


davidxl added inline comments.


================
Comment at: llvm/test/CodeGen/X86/peephole-test-after-add.mir:23
+    %5 = load i64, ptr %0, align 8
+    %6 = and i64 %5, 3
+    %7 = icmp slt i64 %6, 0
----------------
The and instruction clears SF and upper  bits of the value which means the test instruction later will also produce SF == 0. In other words, in this case,  not only the test instruction, but also the CMOVErr can be optimized into a copy.  

(this can be looked at in a follow up patch if it is the case).


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

https://reviews.llvm.org/D124118



More information about the llvm-commits mailing list