[PATCH] D60554: Fix number of args of prof branch_weights MD for SwitchInst

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 01:05:39 PDT 2019


yrouban created this revision.
yrouban added reviewers: asbirlea, fedor.sergeev, mkazantsev.
Herald added subscribers: hiraditya, javed.absar.
Herald added a project: LLVM.

This patch changes //SwitchInst// implementation to keep number of args of //prof branch_weights// metadata consistent across //removeCase()// and //addCase()// calls.
Appropriate code to check this consistency is added to the verifier.
Two ragreedy* tests got their broken prof metadata fixed.
Added several prof branch_weights and appropriate checks to the other 3 tests.

SimplifyCFG.cpp handles the branch weights on its own. It sets the weights when all cases are removed. So it is made to drop the metadata while removing the cases.

Note that this patch does not fix weight values when cases are changed. There will be another patch that implements //prof branch_weights// metadata handling for //SwitchInst// instruction for setting correct weights while adding or changing cases.


https://reviews.llvm.org/D60554

Files:
  llvm/include/llvm/IR/Instructions.h
  llvm/lib/IR/Instructions.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/CodeGen/AArch64/ragreedy-csr.ll
  llvm/test/CodeGen/X86/ragreedy-bug.ll
  llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
  llvm/test/Transforms/SimpleLoopUnswitch/basictest.ll
  llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60554.194643.patch
Type: text/x-patch
Size: 10934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190411/19a8e80b/attachment.bin>


More information about the llvm-commits mailing list