[LoopUnswitch] Properly update MSSA if header has non-clobbering stores.
authorFlorian Hahn <flo@fhahn.com>
Sat, 30 Jan 2021 13:30:48 +0000 (13:30 +0000)
committerFlorian Hahn <flo@fhahn.com>
Sat, 30 Jan 2021 13:51:05 +0000 (13:51 +0000)
commit10c57268c074c3ad48f76da38fa2ba575ee3d1f9
treee32d2539b724282ea4bf9f332d1f0ed9191bed49
parent79125085f16540579d27c7e4987f63eef9c4aa23
[LoopUnswitch] Properly update MSSA if header has non-clobbering stores.

This patch fixes updating MemorySSA if the header contains memory
defs that do not clobber a duplicated instruction. We need to find the
first defining access outside the loop body and use that as defining
access of the duplicated instruction.

This fixes a crash caused by bee486851c1a.
llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/test/Transforms/LoopUnswitch/partial-unswitch-update-memoryssa.ll [new file with mode: 0644]
llvm/test/Transforms/LoopUnswitch/partial-unswitch.ll