summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll
diff options
context:
space:
mode:
authorRobert Lougher <rob.lougher@gmail.com>2016-11-15 14:27:33 +0000
committerRobert Lougher <rob.lougher@gmail.com>2016-11-15 14:27:33 +0000
commitb0905209ddebaa01cf7d4fc24618f4ec137988ca (patch)
tree2f742f8b129576d6b5b5b029c9424bb35d27cd99 /llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll
parent5f850cd1b10f4dffc86285c2f71ab34cba9e929d (diff)
downloadbcm5719-llvm-b0905209ddebaa01cf7d4fc24618f4ec137988ca.tar.gz
bcm5719-llvm-b0905209ddebaa01cf7d4fc24618f4ec137988ca.zip
[LoopVectorizer] When estimating reg usage, unused insts may "end" another use
The register usage algorithm incorrectly treats instructions whose value is not used within the loop (e.g. those that do not produce a value). The algorithm first calculates the usages within the loop. It iterates over the instructions in order, and records at which instruction index each use ends (in fact, they're actually recorded against the next index, as this is when we want to delete them from the open intervals). The algorithm then iterates over the instructions again, adding each instruction in turn to a list of open intervals. Instructions are then removed from the list of open intervals when they occur in the list of uses ended at the current index. The problem is, instructions which are not used in the loop are skipped. However, although they aren't used, the last use of a value may have been recorded against that instruction index. In this case, the use is not deleted from the open intervals, which may then bump up the estimated register usage. This patch fixes the issue by simply moving the "is used" check after the loop which erases the uses at the current index. Differential Revision: https://reviews.llvm.org/D26554 llvm-svn: 286969
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll')
-rw-r--r--llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll b/llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll
index 6133635a8ad..83974d2db80 100644
--- a/llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll
+++ b/llvm/test/Transforms/LoopVectorize/X86/reg-usage.ll
@@ -85,7 +85,7 @@ for.body: ; preds = %for.body, %entry
define i64 @bar(i64* nocapture %a) {
; CHECK-LABEL: bar
; CHECK: LV(REG): VF = 2
-; CHECK: LV(REG): Found max usage: 4
+; CHECK: LV(REG): Found max usage: 3
;
entry:
br label %for.body
OpenPOWER on IntegriCloud