The pasuk says
וַֽאֲנִ֚י | בְּחַסְדְּךָ֣ בָטַחְתִּי֘ יָגֵ֪ל לִבִּ֗י בִּישֽׁוּעָ֫תֶ֥ךָ אָשִׁ֥ירָה לַֽיהֹוָ֑ה כִּ֖י גָמַ֥ל עָלָֽי:
But I trusted in Your loving-kindness, my heart will rejoice in Your salvation; I will sing to the Lord for He has bestowed [it] upon me.
From here the lesson is derived that one should be happy that Hashem will save him even before he is actually saved. He just has Bitachon in the chesed of Hashem and already - יגל לבי בישועתך. But the actual SONG - the שירה [or the Hallel] - is only after the actual salvation - כי גמל עלי.
However, another pasuk seemingly contradicts this:
מְהֻלָּל אֶקְרָ֣א יְהֹוָ֑ה וּמִן־אֹֽ֜יְבַ֗י אִוָּשֵֽׁעַ:
With praise I call to Hashem, and from my enemies I will be saved.
Rashi explains:
With praise I call to the Hashem: With praises I call Him and pray before Him constantly, i.e., even before the salvation I praise Him [i.e. say Hallel], because I am confident that I will be saved from my enemies.