[PATCH] D72944: [InstCombine] Fix worklist management when simplifying demanded bits (PR44541)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 05:21:50 PST 2020


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

This change LGTM.

To fix the infinite loop bug without this change, we could add a clause in canonicalizeMinMaxWithConstant() to avoid creating this:
%cmp = icmp sgt i16 0, %sub

Ie, if the LHS returned by matchSelectPattern() is a constant, swap LHS and RHS because we know we can't create a canonical compare that way. An alternative would be to do that swap within matchSelectPattern() itself. We already have a different LHS/RHS constraint for ABS/NABS on that analysis.

I'm not sure how we can expose that bug with this fix in place though, so might want to make that fix first to be safer?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72944





More information about the llvm-commits mailing list