it depends. i agree that a lot of what we call spoiler are just for looks and a few of these are also there to generate downforce, but there's an increasing ammount of lip soilers wich i believe are really there to help aero as well. if the angle of the roof or windshield goes beyond a certain angle, the flow will separate but if there's a spoiler that extends far enough, even when its parallel to the road or even pointing upwards this might catch the separation bubble and create an overall aerodynamic profile.
a good example of this is the audi A2
the back of the roof and rear window is a curved one piece glass element with a spoiler attached to it.
the round shape is a result of the construction method of the windshield and part of the overall round shape of the car, but it's very bad for aero, the spoiler prevents the air from tripping over but captures the small separation bubble and has the air continue at a 16° angle. (the red line) with a 0.26 Cd i think this is one of the cars where a spoiler actually helps aero
the 16 degree angle is something that seems to be present in a lot of low drag cars as this comparison of rear profiles shows