[PATCH] D62126: [CorrelatedValuePropagation] Fix prof branch_weights metadata handling for SwitchInst

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 14:01:29 PDT 2019


nikic added a comment.

This looks ok, but I wonder if it might make sense to have an explicit update() method for cases (like this) where we need to control the point where the SwitchInst is updated. Something like:

  void update() {
    if (Changed)
      SI.setMetadata(LLVMContext::MD_prof, buildProfBranchWeightsMD());
    Changed = false;
  }
  ~SwitchInstProfUpdateWrapper() {
    update();
  }

I feel like this might be more obvious than extra scopes to control the destruction point.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62126/new/

https://reviews.llvm.org/D62126





More information about the llvm-commits mailing list