The !llvm.loop annotations consist of pointers into the debug info, so when stripping the debug info (particularly important when it is malformed!) !llvm.loop annotations need to be stripped as well, or else the malformed debug info stays around.
rdar://73687049
We should consider keeping the non-debug info metadata within MD_loop to avoid affecting optimization or opt-remarks. I think we can do that with I.setMD(MD_loop, stripDebugLocFromLoopID(MD)).