By shifting down the gear you just add more torque to be able to accelerate up hill. If you don't want to accelerate uphill you can reduce throttle and keep climbing. That brings you into the constant speed uphill situation (constant drag).
Generalizing that situation with a stupid 70yrs old motor: The more RPM you have the more fuel power you loose due to internal motor friction increased oil pump activity, just every device coupled to RPM directly with a belt.
But if you have too little RPM your motor will have to burn all the fuel you give it via your pedal. That may be too much at a time. The pressure on the sealings rises and the oil gets heated more than fine at certain points of friction. Not good.
Also you lose fuel power due to drag... as the motor parts are quickly getting faster on ignition but then suddenly get slower due to the high gear you chose and the hill.
General Guide
If your motor squeals, you hear motor friction and waste fuel. If your little 1.3L motor growls and gurgles like a huge 3L Ford Mustang, you are breaking your cylinder head sealings right now.
Now for modern Motors: Most cars have adaptive compressed injection motors nowadays. It is not widely marketed and explained as most people don't care about technology when buying cars. Most of those technologies are actively tested in motor sports like F1 but mostly Rallies like Paris-Dakar.
The point is: the cylinders of modern motors are not just flat at the top. They are curved at different angles on different places. There are several injection nozzles that aim at those angled surfaces. When the fuel beam collides with those surfaces it is distributed differently and determines if if will be dense (and burn quickly) or scattered and burn slow.
(There are even areas where fuel will burn quick in the cycle or late in combination with dense or scattered. A modern car has more than three nozzles per cylinder that can be combined in output to reach different 'fuelburning' properties per cycle. The software does the calculations several thousands times a second.)
The software of the motor decides how to burn the fuel. As an input the engine software takes your fuel pedal movement.
- How far did you push? (Want more fuel?)
- How fast did you push? (Want to accelerate quickly?)
- Does your car have an 'eco mode' activated?
- Did you release after quick push? (No acceleration wished.)
Modern motors (last 5-10 years) govern your pedal input depending on their firmware (yes, engines are IT devices too by now.)
Summary
At too high RPM the motor firmware can't beat internal motor friction. You waste fuel if software does not govern quickly.
At too low RPM your engine sealings get all the stress. But motor firmware tries to ensure RPM.
If it is not smart enough to shut you off and reduce throttle by software, you actively break your engine every time it gurgles in a slow gear.
(E.g. DodgeViper still allows to totally break the engine by manual input in 10 minutes. I've seen people exploding the viper-cylinder-sealings in that time.)
Engines are not made to run at very slow RPM (under 2000) for minutes when you are climbing. They are designed for 2000-5000, as RPM directly determines the pressure release per minute via the valves.
Just keep in at a nice snurring sound (2.200-3600 rpm) and drive up that hill without(!) getting faster. The software, programmed by people who have an army of engineers behind, does the rest if you have a 2007 up car.