[PATCH] D60604: [IR] Improve SwitchInst API to support prof branch_weights

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 12 03:32:52 PDT 2019


yrouban created this revision.
yrouban added reviewers: asbirlea, chandlerc, fedor.sergeev, spatel.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

This patch adds prof branch_weight as an optional parameter to add/remove and set successor methods.
This way preserves correctness of passes with respect to SwitchInst instructions' perf branch_weights metadata.

One of important assumption is that in a SwitchInst instruction we usually chang its metadata first and then its cases. In add/remove methods the branch weights are not changed if their dimension is not equal to the number of successors because this means that the metadata has been changed by other means.


https://reviews.llvm.org/D60604

Files:
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/IR/Instructions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60604.194828.patch
Type: text/x-patch
Size: 8303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190412/d6c5c230/attachment.bin>


More information about the llvm-commits mailing list