[SimplifyCFG] Preserve metadata when unconditionalizing branches (constant condition).
authorMichael Kruse <llvm-project@meinersbur.de>
Mon, 26 Apr 2021 15:52:06 +0000 (10:52 -0500)
committerMichael Kruse <llvm-project@meinersbur.de>
Mon, 26 Apr 2021 15:57:31 +0000 (10:57 -0500)
commit153144be40855ca1e35e1bfca082e10f553bb2e5
treeb1131ce68f676b31f9bcdfc5d785d358f73838ca
parent858d4885dcc2242910971607bf46428d5b563d95
[SimplifyCFG] Preserve metadata when unconditionalizing branches (constant condition).

When replacing a conditional branch by an unconditional one because the condition is a constant, transfer the metadata to the new branch instruction.

Part of fix for llvm.org/PR50060

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D101141
llvm/lib/Transforms/Utils/Local.cpp
llvm/test/Transforms/SimplifyCFG/pr50060-constantfold-loopid.ll [new file with mode: 0644]