Cleanup : Use metadata preserving API for branch creation

Use the wrapper API in IRBuilder that does meta data copy
to create new branch in LoopUnswitch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280602 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Xinliang David Li 2016-09-03 22:26:11 +00:00
parent da48846879
commit 1f44212e7e

View File

@ -763,15 +763,10 @@ void LoopUnswitch::EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val,
} }
// Insert the new branch. // Insert the new branch.
BranchInst *BI = BranchInst::Create(TrueDest, FalseDest, BranchVal, InsertPt); BranchInst *BI =
if (TI) { IRBuilder<>(InsertPt).CreateCondBr(BranchVal, TrueDest, FalseDest, TI);
// FIXME: check why white list is needed here: if (Swapped)
unsigned WL[3] = {LLVMContext::MD_dbg, LLVMContext::MD_prof, BI->swapProfMetadata();
LLVMContext::MD_make_implicit};
BI->copyMetadata(*TI, makeArrayRef(&WL[0], 3));
if (Swapped)
BI->swapProfMetadata();
}
// If either edge is critical, split it. This helps preserve LoopSimplify // If either edge is critical, split it. This helps preserve LoopSimplify
// form for enclosing loops. // form for enclosing loops.