This is a follow up D104782 that I reverted because of a failure in the llvm test suite. This is a diff against my local repo where I have first recommitted that again, just for clarity to only show this change.
The miscompile is made visible with a Bitcast node, that is lowered to a Store followed by a Load. The new Load instruction got the wrong operand (the DAG entry), so that the store instruction was no longer connected and removed.
Minor change for code clarity.