https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #11 from Andrew Pinski ---
Thinking about this some more, this is a not a hoisting problem but a sinking
problem.
basically we have:
int f(void);
int h(void);
int g(int a)
{
if (a)
return f() + 10;
return h() + 10;
}
Which
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #10 from rguenther at suse dot de ---
On Tue, 3 Oct 2017, jakub at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
>
> --- Comment #9 from Jakub Jelinek ---
> So it means maybe llvm performs more advance
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #9 from Jakub Jelinek ---
So it means maybe llvm performs more advanced switchconv in this case, at least
judging from the #c0 assembly snippet. We look solely for PHIs which have
arguments SSA_NAMEs initialized in the cases to const
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #8 from Antony Polukhin ---
Yes, in the isolated test case constants are first:
static inline double eval_square2(double r) { return 4 * r * r; }
static inline double eval_circle2(double r) { return 3.1415 * r * r; }
double test_swi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #7 from Andrew Pinski ---
Multiply binds left to right.
That is a * b * c is the same as (a * b) * c and not the same as A * (b * c).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #6 from Antony Polukhin ---
> And I don't think you can reassociate here validly unless -ffast-math.
But you can. In the isolated test case, instead of getting r*r at first, just
move the constant into the xmm1 first and after that m
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #5 from Martin Liška ---
(In reply to Andrew Pinski from comment #4)
> > Isolated test-case where we do not reassociate expressions:
>
> And I don't think you can reassociate here validly unless -ffast-math.
Yep, you're right. With
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #4 from Andrew Pinski ---
> Isolated test-case where we do not reassociate expressions:
And I don't think you can reassociate here validly unless -ffast-math.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #3 from Martin Liška ---
Isolated test-case where we do not reassociate expressions:
$ cat pr82405-reduced2.c
static inline double eval_square(double r) { return r * r * 4; }
static inline double eval_circle(double r) { return r * r
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
--- Comment #2 from Martin Liška ---
> Having a simpler test-case:
> $ cat pr82405-2.c
> enum class eShape { eSquare, eCircle, eShpere, eTetraeder };
>
> double test_switch_native(eShape shape, double r) {
> switch(shape) {
> case eShape
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82405
Martin Liška changed:
What|Removed |Added
Keywords||missed-optimization
Status|UN
11 matches
Mail list logo