[llvm] r280602 - Cleanup : Use metadata preserving API for branch creation

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 3 15:26:11 PDT 2016


Author: davidxl
Date: Sat Sep  3 17:26:11 2016
New Revision: 280602

URL: http://llvm.org/viewvc/llvm-project?rev=280602&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=280602&r1=280601&r2=280602&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Sat Sep  3 17:26:11 2016
@@ -763,15 +763,10 @@ void LoopUnswitch::EmitPreheaderBranchOn
   }
 
   // Insert the new branch.
-  BranchInst *BI = BranchInst::Create(TrueDest, FalseDest, BranchVal, InsertPt);
-  if (TI) {
-    // FIXME: check why white list is needed here:
-    unsigned WL[3] = {LLVMContext::MD_dbg, LLVMContext::MD_prof,
-                      LLVMContext::MD_make_implicit};
-    BI->copyMetadata(*TI, makeArrayRef(&WL[0], 3));
-    if (Swapped)
-      BI->swapProfMetadata();
-  }
+  BranchInst *BI =
+      IRBuilder<>(InsertPt).CreateCondBr(BranchVal, TrueDest, FalseDest, TI);
+  if (Swapped)
+    BI->swapProfMetadata();
 
   // If either edge is critical, split it. This helps preserve LoopSimplify
   // form for enclosing loops.




More information about the llvm-commits mailing list