If you don't use an EAD, you may still keep your H-1 even you're in AOS. Using the EAD will lose your H-1.
After you have used EAD, you will need to leave US when your I-140 or I-485 is denied, and apply a visa if you want to be back. If you keep H-1, in above case you are still legal to stay.