[PATCH] D62190: [RISCV] Allow shrink wrapping for RISC-V
Lewis Revill via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 08:28:24 PDT 2019
lewis-revill added a comment.
Herald added a subscriber: sameer.abuasal.
So I've been looking into the benchmarks that I've been running to figure out why code doesn't change with this enabled.
I found that GCC's shrink wrapping does make a difference, and that comes from a loop which looks like the following:
int foo(int rpt) {
int i;
int r;
for (i = 0; i < rpt; ++i) {
srand(0);
r = ...;
}
return r;
}
GCC appears to convert this into the equivalent of:
int foo(int rpt) {
if (rpt == 0)
return 0;
int i;
int r;
for (i = 0; i < rpt; ++i) {
srand(0);
r = ...;
}
return r;
}
And is then able to shrink wrap around the if statement. Sure enough, if I feed the modified function above into LLVM, we are able to shrink wrap it as well.
(I'm not certain if this conversion is sane from GCC, but I haven't properly looked into it.)
So personally I'm not concerned about the fact that shrink wrapping doesn't make a difference in my benchmarks; I can show that it changes C code we expect it to change... I'm not so sure about the lack of differences with SPEC though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62190/new/
https://reviews.llvm.org/D62190
More information about the llvm-commits
mailing list