Lattice Diamond design software and ispLEVER Classic design tools extend their HDL attributes option in Schematic Editor.
To preserve a signal, click on the signal and right-click on it. The object properties window will open up. Select your desired wire, and you will observe several attributes associated with it. Select the syn_keep/keep attribute and set it to True.
Then, the synthesizer will not optimize away the signal.