It is indeed optimized away:
julia> function f()
state = MyState{Float64}()
pushIn!(state,9)
pushIn!(state,99)
return sum(state.volstack)
end
f (generic function with 1 method)
julia> @code_llvm f()
; @ REPL[4]:1 within `f`
; Function Attrs: uwtable
define i32 @julia_f_573() #0 {
L188:
; @ REPL[4]:5 within `f`
ret i32 108
}