[CodeExtractor] Fix extraction of a value used only by intrinsics outside of region
authorEhud Katz <ehudkatz@gmail.com>
Sat, 25 Apr 2020 08:44:47 +0000 (11:44 +0300)
committerEhud Katz <ehudkatz@gmail.com>
Sat, 25 Apr 2020 08:44:47 +0000 (11:44 +0300)
commit64249f177e4644cfe3a0ba80ade274175771950c
tree6e3ac4b166b9753b09280256e42bd5c28172846d
parent72af0bf1760919adb2b08b9eed0ca05e1e45a6d5
[CodeExtractor] Fix extraction of a value used only by intrinsics outside of region

We should only skip `lifetime` and `dbg` intrinsics when searching for users.
Other intrinsics are legit users that can't be ignored.

Without this fix, the testcase would result in an invalid IR. `memcpy`
will have a reference to the, now, external value (local to the
extracted loop function).

Fix PR42194

Differential Revision: https://reviews.llvm.org/D78749
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/test/Transforms/CodeExtractor/LoopExtractor_alloca.ll [new file with mode: 0644]