[PATCH] D45065: [InstCombine] Fix PR17564: don't fold [zs]ext into phi.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 29 14:49:25 PDT 2018
lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, craig.topper.
Herald added a subscriber: kristof.beyls.
Motivational case is highlighted in PR17564 <https://bugs.llvm.org/show_bug.cgi?id=17564>:
int f(int x) {
return (x & 1) || (x & 2);
}
If the function return type is `bool`, then the IR is just `and`+`icmp`.
But if it is `int`, then it has `select`, and whatnot.
https://godbolt.org/g/uTJVVo
If one analyzes `-print-after-all`, thing appear to go bad when we fold `zext` into `phi`.
If we don't do that, then the behavior is the same as with `i1`, and PR17564 is fixed.
Also, the second part is needed, to get rid of `select` if possible,
e.g. https://godbolt.org/g/iAYRup, but that is another issue.
Now, i'm not quite sure whether *this* fix is correct?
Two other tests changed, but those changes do not look harmful?
Testing: `ninja check-llvm`
Fixes PR17564.
If this makes sense i'll commit test changes as NFC, and rebase.
Repository:
rL LLVM
https://reviews.llvm.org/D45065
Files:
lib/Transforms/InstCombine/InstCombineCasts.cpp
test/Transforms/InstCombine/ext-of-select-of-bittest.ll
test/Transforms/InstCombine/icmp-div-constant.ll
test/Transforms/InstCombine/icmp-mul-zext.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45065.140335.patch
Type: text/x-patch
Size: 9341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/883dc914/attachment.bin>
More information about the llvm-commits
mailing list