[PATCH] D91589: [DAGCombiner] Fold (sext (not i1 x)) -> (add (zext i1 x), -1)

Layton Kifer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 04:42:14 PST 2020


laytonio added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/sext-zext-trunc.ll:477
 
-;; TODO: fold (sext (not (setcc a, b, cc))) -> (sext (setcc a, b, !cc))
+;; fold (sext (not (setcc a, b, cc))) -> (sext (setcc a, b, !cc))
 define i32 @sext_of_not_cmp_i32(i32 %x) {
----------------
RKSimon wrote:
> Not sure what comment should be here if RISCV doesn't actually do the fold 
Unless I'm missing something trunk was already doing this fold. I added this as a test case because, without checking if we could fold away the not by converting back to a sign extend, we would have regressed here. After this patch the codegen of sext_of_not_cmp and dec_of_zexted_cmp should be identical. I can remove these if you think they're redundant.


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

https://reviews.llvm.org/D91589



More information about the llvm-commits mailing list