* [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns
2013-02-17 15:27 [Bug tree-optimization/56365] New: Missed opportunities for smin/smax standard name patterns olegendo at gcc dot gnu.org
@ 2013-02-18 10:58 ` rguenth at gcc dot gnu.org
2013-02-18 20:05 ` olegendo at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-18 10:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56365
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-02-18
Ever Confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-18 10:58:13 UTC ---
I see, at -O2, on x86_64 in 070t.phiopt:
test_04 (int a, int b)
{
int D.1744;
int D.1741;
int _3;
int _4;
<bb 2>:
_3 = MIN_EXPR <a_1(D), 127>;
_4 = MAX_EXPR <_3, -128>;
return _4;
}
for the other cases you run into the issue that the tree-level phiopt
can be confused by phi-merging:
test_05 (int a)
{
<bb 2>:
if (a_2(D) > 126)
goto <bb 5>;
else
goto <bb 3>;
<bb 3>:
if (a_2(D) < -127)
goto <bb 5>;
else
goto <bb 4>;
<bb 4>:
<bb 5>:
# a_1 = PHI <127(2), a_2(D)(4), -128(3)>
return a_1;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns
2013-02-17 15:27 [Bug tree-optimization/56365] New: Missed opportunities for smin/smax standard name patterns olegendo at gcc dot gnu.org
2013-02-18 10:58 ` [Bug tree-optimization/56365] " rguenth at gcc dot gnu.org
@ 2013-02-18 20:05 ` olegendo at gcc dot gnu.org
2014-05-10 12:52 ` [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns when compiling as C++ olegendo at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-02-18 20:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56365
--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> 2013-02-18 20:04:40 UTC ---
(In reply to comment #1)
> I see, at -O2, on x86_64 in 070t.phiopt:
>
> test_04 (int a, int b)
> {
> int D.1744;
> int D.1741;
> int _3;
> int _4;
>
> <bb 2>:
> _3 = MIN_EXPR <a_1(D), 127>;
> _4 = MAX_EXPR <_3, -128>;
> return _4;
>
> }
Ah yes, now I see that here, too. I don't know where or how I was looking,
sorry.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns when compiling as C++
2013-02-17 15:27 [Bug tree-optimization/56365] New: Missed opportunities for smin/smax standard name patterns olegendo at gcc dot gnu.org
2013-02-18 10:58 ` [Bug tree-optimization/56365] " rguenth at gcc dot gnu.org
2013-02-18 20:05 ` olegendo at gcc dot gnu.org
@ 2014-05-10 12:52 ` olegendo at gcc dot gnu.org
2014-07-31 17:04 ` olegendo at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-05-10 12:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56365
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Missed opportunities for |Missed opportunities for
|smin/smax standard name |smin/smax standard name
|patterns |patterns when compiling as
| |C++
--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #2)
> (In reply to comment #1)
> > I see, at -O2, on x86_64 in 070t.phiopt:
> >
> > test_04 (int a, int b)
> > {
> > int D.1744;
> > int D.1741;
> > int _3;
> > int _4;
> >
> > <bb 2>:
> > _3 = MIN_EXPR <a_1(D), 127>;
> > _4 = MAX_EXPR <_3, -128>;
> > return _4;
> >
> > }
>
> Ah yes, now I see that here, too. I don't know where or how I was looking,
> sorry.
If compiled as C (-x c -std=gnu99) the min/max patterns work. Compiling as C++
(-x c++ -std=c++11) does not work. Probably that was reason for my original
confusion -- usually I compile such small test snippets as C++ ...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns when compiling as C++
2013-02-17 15:27 [Bug tree-optimization/56365] New: Missed opportunities for smin/smax standard name patterns olegendo at gcc dot gnu.org
` (2 preceding siblings ...)
2014-05-10 12:52 ` [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns when compiling as C++ olegendo at gcc dot gnu.org
@ 2014-07-31 17:04 ` olegendo at gcc dot gnu.org
2014-10-17 10:14 ` olegendo at gcc dot gnu.org
2014-10-17 11:41 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-07-31 17:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56365
--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
As of r213381 this problem still exists.
compiled as C 003t.original:
;; Function min (null)
;; enabled by -tree-original
{
return MIN_EXPR <b, a>;
}
;; Function max (null)
;; enabled by -tree-original
{
return MAX_EXPR <a, b>;
}
;; Function test_04 (null)
;; enabled by -tree-original
{
return max (-128, min (127, a));
}
compiled as C++ 003t.original:
;; Function int min(int, int) (null)
;; enabled by -tree-original
return <retval> = a < b ? a : b;
;; Function int max(int, int) (null)
;; enabled by -tree-original
return <retval> = a < b ? b : a;
;; Function int test_04(int, int) (null)
;; enabled by -tree-original
<<cleanup_point return <retval> = max (-128, min (127, a))>>;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns when compiling as C++
2013-02-17 15:27 [Bug tree-optimization/56365] New: Missed opportunities for smin/smax standard name patterns olegendo at gcc dot gnu.org
` (3 preceding siblings ...)
2014-07-31 17:04 ` olegendo at gcc dot gnu.org
@ 2014-10-17 10:14 ` olegendo at gcc dot gnu.org
2014-10-17 11:41 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-10-17 10:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56365
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Richard, any chance this might get fixed with the match-and-simplify branch?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/56365] Missed opportunities for smin/smax standard name patterns when compiling as C++
2013-02-17 15:27 [Bug tree-optimization/56365] New: Missed opportunities for smin/smax standard name patterns olegendo at gcc dot gnu.org
` (4 preceding siblings ...)
2014-10-17 10:14 ` olegendo at gcc dot gnu.org
@ 2014-10-17 11:41 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-10-17 11:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56365
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
No, that doesn't handle PHI nodes. phiopt needs to be improved to handle
merged PHIs for this case.
^ permalink raw reply [flat|nested] 7+ messages in thread