diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2015-09-27 20:34:31 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2015-09-27 20:34:31 +0000 |
| commit | 9533407566c3bafa96d7000e460cf49919acbd38 (patch) | |
| tree | 5cea6fee5e7729e2c92bf6b036e3c17b7b5621aa /llvm/lib/ProfileData/InstrProfIndexed.h | |
| parent | 0722a1e5d5fcd2c126ea009ff85ad6b04a5fdf28 (diff) | |
| download | bcm5719-llvm-9533407566c3bafa96d7000e460cf49919acbd38.tar.gz bcm5719-llvm-9533407566c3bafa96d7000e460cf49919acbd38.zip | |
[InstCombine] fold zexts and constants into a phi (PR24766)
This is one step towards solving PR24766:
https://llvm.org/bugs/show_bug.cgi?id=24766
We were not producing the same IR for these two C functions because the store
to the temp bool causes extra zexts:
#include <stdbool.h>
bool switchy(char x1, char x2, char condition) {
bool conditionMet = false;
switch (condition) {
case 0: conditionMet = (x1 == x2); break;
case 1: conditionMet = (x1 <= x2); break;
}
return conditionMet;
}
bool switchy2(char x1, char x2, char condition) {
switch (condition) {
case 0: return (x1 == x2);
case 1: return (x1 <= x2);
}
return false;
}
As noted in the code comments, this test case manages to avoid the more general existing
phi optimizations where there are only 2 phi inputs or where there are no constant phi
args mixed in with the casts ops. It seems like a corner case, but if we don't catch it,
then I don't think we can get SimplifyCFG to further optimize towards the canonical form
for this function shown in the bug report.
Differential Revision: http://reviews.llvm.org/D12866
llvm-svn: 248689
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfIndexed.h')
0 files changed, 0 insertions, 0 deletions

