[llvm-dev] Why LLVM cannot optimize this?
Sanjoy Das via llvm-dev
llvm-dev at lists.llvm.org
Wed Mar 2 18:54:36 PST 2016
On Wed, Mar 2, 2016 at 5:51 PM, Hongbin Zheng <etherzhhb at gmail.com> wrote:
> While SCEV provides a generic framework to calculate the loop exit values,
> may be what zet asking is just an instcomb that replace the loop exit value
> of zero by 0, when zero is initialized to 0 before the loop?
A special rule would help this specific case (and if getting this
specific case is important for some reason, we should consider
it), but ideally we should also be able to, say, fold
unsigned foo(int a) {
unsigned x = 1;
for (int i = 0; i < a; i++)
x *= 2;
return x;
}
into a compare and a shift, and things like that.
So my question to zet is: is there a specific case you're looking at
where optimizing
the specific pattern you pointed out is important?
Thanks,
-- Sanjoy
More information about the llvm-dev
mailing list