mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-03 14:21:30 +00:00
Teach IRCE to look at branch weights when recognizing range checks
Splitting a loop to make range checks redundant is profitable only if the range check "never" fails. Make this fact a part of recognizing a range check -- a branch is a range check only if it is expected to pass (via branch_weights metadata). Differential Revision: http://reviews.llvm.org/D7192 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,7 +13,7 @@ define void @single_access_with_preloop(i32 *%arr, i32 *%a_len_ptr, i32 %n, i32
|
||||
%abc.high = icmp slt i32 %array.idx, %len
|
||||
%abc.low = icmp sge i32 %array.idx, 0
|
||||
%abc = and i1 %abc.low, %abc.high
|
||||
br i1 %abc, label %in.bounds, label %out.of.bounds
|
||||
br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1
|
||||
|
||||
in.bounds:
|
||||
%addr = getelementptr i32* %arr, i32 %array.idx
|
||||
@@ -57,3 +57,4 @@ define void @single_access_with_preloop(i32 *%arr, i32 *%a_len_ptr, i32 %n, i32
|
||||
; CHECK: br i1 %next.postloop, label %loop.postloop, label %exit.loopexit
|
||||
|
||||
!0 = !{i32 0, i32 2147483647}
|
||||
!1 = !{!"branch_weights", i32 64, i32 4}
|
||||
|
||||
Reference in New Issue
Block a user