[clang] [SCCP] [Transform] Adding ICMP folding for zext and sext in SCCPSolver (PR #67594)

LĂ©onard Oest O'Leary via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 13:46:25 PDT 2023


leo-ard wrote:

> If I understood correctly, what you're trying to do here is to apply an icmp fold early before the sext -> zext information gets lost. I don't think this is the correct way to approach the problem. The correct way is to preserve the fact that the operand is non-negative when converting to zext, which would allow the InstCombine fold to reliably undo this. In fact, there is a pending patch for this at https://reviews.llvm.org/D156444.

When tackling this problem, my first idea was to track the non-negativeness of the zext and use this information in InstCombine. I didn't know that you could do it through flags in the IR, which I think is a cleaner solution. Do you think this patch will be available soon ?


https://github.com/llvm/llvm-project/pull/67594


More information about the cfe-commits mailing list