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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 14:23:46 PDT 2019


nikic added a comment.

Providing an obviously incorrect branch_weights for one of the added test cases is enough to cause an assertion failure:

  define i32 @crash(i32 %s) {
  entry:
    %cmp = icmp sgt i32 %s, 0
    br i1 %cmp, label %positive, label %out
  
  positive:
    switch i32 %s, label %out [
    i32 1, label %next
    i32 -1, label %next
    i32 -2, label %next
    ], !prof !{!"branch_weights"} ; not enough elements
  
  out:
    %p = phi i32 [ -1, %entry ], [ 1, %positive ]
    ret i32 %p
  
  next:
    %q = phi i32 [ 0, %positive ], [ 0, %positive ], [ 0, %positive ]
    ret i32 %q
  }


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62126





More information about the llvm-commits mailing list