There are a few issues here: - CombineTo() calls ReplaceAllUsesWith(), which calls transferDbgValues(). If we assert that debug line/value information is preserved after the RAUW in CombineTo(), a bunch of tests fail. - Clients of transferDbgValues() pass it SDValues which are attached to SDNodes with invalidated debug info. It seems unfortunate that we'd even try to propagate invalid debug info. - One overload of ReplaceAllUsesWith(From, To) requires From != To, but another doesn't. This is partly annoying, but may also be masking correctness issues.
Created attachment 19445 [details] Rough patch to enforce "don't drop debug info" in CombineTo(). I've attached a rough patch which should enforce "don't drop debug info" in CombineTo(), in case anyone wants to poke around with it. I probably won't get to this until after Thanksgiving.