[Bug optimization/15017] [tree-ssa] compare (equal) with casts are not removed

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Apr 20 15:03:00 GMT 2004


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-20 14:34 -------
And here is the tree dump for patches which I have in my local tree (my cast pass and addition to PHI-
OPT to work with different types and one which combines the return statements):

;; Function foo (foo)

foo (a, b)
{
<bb 0>:
  return ((int)a != (int)b);  <-- conversion to int not needed

}

;; Function foo0 (foo0)

foo0 (a)
{
<bb 0>:
  return (a != 0);  <-- same as a cast to int, I have to think of a better way of doing this.

}



;; Function bar (bar)

bar (a)
{
<bb 0>:
  return (int)a;  <-- good code as _Bool is promoted to int by the ABI

}



;; Function foo2 (foo2)

foo2 ()
{
<bb 0>:
  return ((int)T.a != (int)T.b);  <--- extranous casts

}



;; Function foo3 (foo3)

foo3 ()
{
<bb 0>:
  return ((int)as != (int)bs);  <--- likewise

}



;; Function foo1 (foo1)

foo1 (a, b)
{
<bb 0>:
  return ((int)a != 0);  <--- likewise, and comparision
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15017



More information about the Gcc-bugs mailing list