Optional attribute and compiler optimisation?

I was just thinking about the optional attribute, present() and optimisation by compilers.

subroutine foo(arg1, arg2)
real, intent(in) :: arg1
real, optional, intent(in) :: arg2

if (present(arg2)) then blabla...

If I use some aggressive optimization option implying inlining, will the compiler remove the if statement if arg2 is not present in a call? (I guess or I hope so)

It certainly could, but no guarantees.