[PATCH] D45108: [InstCombine] Get rid of select of bittest (PR36950 / PR17564)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 4 13:03:17 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D45065#1054271, @spatel wrote:

> I think we should solve this using something like https://reviews.llvm.org/D45108 instead, but I need to look closer at how the case in the bug report escaped the matching that we already have in foldSelectInstWithICmp() and foldSelectICmpAnd().


Ok, so let's look at those functions

- `foldSelectICmpAnd()` is only called when the select has constants as both true and false values https://github.com/llvm-mirror/llvm/blob/0b1a72a7a6069b674f1859ec859e846e6dc63594/lib/Transforms/InstCombine/InstCombineSelect.cpp#L794-L800 This isn't the case in these tests, only the false-value is constant.
- Same with the fold before that call https://github.com/llvm-mirror/llvm/blob/0b1a72a7a6069b674f1859ec859e846e6dc63594/lib/Transforms/InstCombine/InstCombineSelect.cpp#L757-L791 Only works on constants.

So while i don't have any particular expirience with InstCombine,
i don't see anything that would suggest that `foldSelectInstWithICmp()`
is already supposed to handle that case. Am i wrong?

But yes, i should at the very least move the code into that function.


Repository:
  rL LLVM

https://reviews.llvm.org/D45108





More information about the llvm-commits mailing list