[PATCH] D126591: [InstCombine] Optimise shift+and+boolean conversion pattern to simple comparison

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 28 04:32:28 PDT 2022


spatel added a comment.

This patch is not sufficient to solve the bug in general. The IR for the bug report does not contain any `icmp`, so we can write alternate forms of the source from that bug report and fail to optimize again (and gcc may fail to canonicalize):
https://godbolt.org/z/n9oaWTa8s

Either we need to convert the IR to cmp+select or make this a codegen optimization.

I'm not sure what impact this will have in IR, but you could try to write transforms like this in instcombine and see if that exposes other problems:
https://alive2.llvm.org/ce/z/jA_tNb


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

https://reviews.llvm.org/D126591



More information about the llvm-commits mailing list