[llvm] r247174 - allow unpredictable metadata on switch statements

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 11:38:31 PDT 2015


Author: spatel
Date: Wed Sep  9 13:38:30 2015
New Revision: 247174

URL: http://llvm.org/viewvc/llvm-project?rev=247174&view=rev
Log:
allow unpredictable metadata on switch statements

Modified:
    llvm/trunk/include/llvm/IR/IRBuilder.h

Modified: llvm/trunk/include/llvm/IR/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=247174&r1=247173&r2=247174&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/IR/IRBuilder.h Wed Sep  9 13:38:30 2015
@@ -632,10 +632,10 @@ public:
   /// and with a hint for the number of cases that will be added (for efficient
   /// allocation).
   SwitchInst *CreateSwitch(Value *V, BasicBlock *Dest, unsigned NumCases = 10,
-                           MDNode *BranchWeights = nullptr) {
-    // TODO: Add unpredictable metadata for a switch.
+                           MDNode *BranchWeights = nullptr,
+                           MDNode *Unpredictable = nullptr) {
     return Insert(addBranchMetadata(SwitchInst::Create(V, Dest, NumCases),
-                                    BranchWeights, nullptr));
+                                    BranchWeights, Unpredictable));
   }
 
   /// \brief Create an indirect branch instruction with the specified address




More information about the llvm-commits mailing list