topperc wrote: I've updated the patch to check isLegalAddImmediate for the constant we that promotion will generate. If it's not legal we continue treating the add as a source instead of promoting it. https://github.com/llvm/llvm-project/pull/81690