4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/X86/call-remark.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt -debugify -loop-unroll -mcpu=znver3 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s
; RUN: opt -debugify -loop-unroll -mcpu=znver3 -pass-remarks=TTI -pass-remarks-analysis=TTI < %s -S 2>&1 | FileCheck --check-prefixes=ALL,TTI %s
; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=loop-unroll -pass-remarks-analysis=loop-unroll < %s -S 2>&1 | FileCheck --check-prefixes=ALL,UNROLL %s
; RUN: opt -passes=debugify,loop-unroll -mcpu=znver3 -pass-remarks=TTI -pass-remarks-analysis=TTI < %s -S 2>&1 | FileCheck --check-prefixes=ALL,TTI %s

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/X86/mmx.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/X86/partial.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt < %s -S -loop-unroll -mcpu=nehalem | FileCheck %s
; RUN: opt < %s -S -loop-unroll -unroll-runtime=0 | FileCheck -check-prefix=CHECK-NOUNRL %s
; RUN: opt < %s -S -passes=loop-unroll -mcpu=nehalem | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=0 | FileCheck -check-prefix=CHECK-NOUNRL %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -loop-unroll -costmodel-reduxcost -S -o - %s | FileCheck %s
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -passes=loop-unroll -costmodel-reduxcost -S -o - %s | FileCheck %s

define void @g() {
; CHECK-LABEL: @g(
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/X86/pr46430.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -loop-unroll -costmodel-reduxcost -S -o - %s | FileCheck %s
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -passes=loop-unroll -costmodel-reduxcost -S -o - %s | FileCheck %s

define void @g() {
; CHECK-LABEL: @g(
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/assume-timeout.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -unroll-threshold=300 -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -unroll-threshold=300 -S < %s | FileCheck %s

; This test caused a compile-time explosion in ValueTracking
; because we cloned the assume value and call greatly and
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/basic.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -loop-unroll -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -S | FileCheck %s
; RUN: opt < %s -passes='require<opt-remark-emit>,loop-unroll' -S | FileCheck %s


Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/callbr.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S %s | FileCheck %s

; Check that the loop body containing callbr is correctly unrolled.
define dso_local void @d() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s -loop-unroll -unroll-threshold=42 | FileCheck %s --check-prefix=ANALYZE-FULL
; RUN: opt -S < %s -passes=loop-unroll -unroll-threshold=42 | FileCheck %s --check-prefix=ANALYZE-FULL

; This test is supposed to check that calls to @llvm.assume builtin are not
; prohibiting the analysis of full unroll profitability in case the cost of the
Expand All @@ -9,7 +9,7 @@
; Ensure that we indeed are testing this code path by verifying that the loop is
; not unrolled without such analysis:

; RUN: opt -S < %s -loop-unroll -unroll-threshold=42 -unroll-max-iteration-count-to-analyze=2 \
; RUN: opt -S < %s -passes=loop-unroll -unroll-threshold=42 -unroll-max-iteration-count-to-analyze=2 \
; RUN: -unroll-peel-max-count=0 | FileCheck %s --check-prefix=DONT-ANALYZE-FULL

; Function Attrs: nounwind
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/convergent.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -loop-unroll -unroll-runtime -unroll-allow-partial -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -unroll-runtime -unroll-allow-partial -S | FileCheck %s

declare void @f() convergent

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/dce.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S < %s | FileCheck %s

; Can't recursively delete %c.addr.07 without deleting %conv1
; and thus invalidating iteration.
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/debug-info.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt %s -S -o - -loop-unroll | FileCheck %s
; RUN: opt %s -S -o - -passes=loop-unroll | FileCheck %s
; generated at -O3 from:
; void f() {
; for (int i = 1; i <=32; i <<=2 )
Expand Down Expand Up @@ -27,7 +27,7 @@ for.body: ; preds = %entry, %for.body
; CHECK: call void @llvm.dbg.value(metadata i32 4, metadata !12, metadata !DIExpression()), !dbg !15
; CHECK: call void @llvm.dbg.value(metadata i32 16, metadata !12, metadata !DIExpression()), !dbg !15
; CHECK: call void @llvm.dbg.value(metadata i32 64, metadata !12, metadata !DIExpression()), !dbg !15

%call = tail call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 %shr) #3, !dbg !20
%shl = shl i32 %i.04, 2, !dbg !21
tail call void @llvm.dbg.value(metadata i32 %shl, metadata !12, metadata !DIExpression()), !dbg !15
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/disable_nonforced.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -unroll-count=2 -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -unroll-count=2 -S < %s | FileCheck %s
;
; Check that the disable_nonforced loop property is honored by
; loop unroll.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/disable_nonforced_count.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -unroll-count=2 -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -unroll-count=2 -S < %s | FileCheck %s
;
; Check whether the llvm.loop.unroll.count loop property overrides
; llvm.loop.disable_nonforced.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -unroll-count=2 -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -unroll-count=2 -S < %s | FileCheck %s
;
; Check that the llvm.loop.unroll.enable loop property overrides
; llvm.loop.disable_nonforced.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/disable_nonforced_full.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S < %s | FileCheck %s
;
; Check that the llvm.loop.unroll.full loop property overrides
; llvm.loop.disable_nonforced.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/ephemeral.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-threshold=50 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=50 | FileCheck %s

; Make sure this loop is completely unrolled...
; CHECK-LABEL: @test1
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/epilog_const_phi.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -S -loop-unroll -unroll-runtime < %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll -unroll-runtime < %s | FileCheck %s

; Epilog unroll allows to keep PHI constant value.
; For the test this means that after unroll XOR could be deleted.
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/LoopUnroll/followup.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt < %s -S -loop-unroll -unroll-count=2 | FileCheck %s -check-prefixes=COUNT,COMMON
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
; RUN: opt < %s -S -passes=loop-unroll -unroll-count=2 | FileCheck %s -check-prefixes=COUNT,COMMON
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
;
; Check that followup-attributes are applied after LoopUnroll.
;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/full-unroll-bad-cost.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -S -loop-unroll < %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll < %s | FileCheck %s
; RUN: opt < %s -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -S | FileCheck %s

; LLVM should not try to fully unroll this loop.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/full-unroll-crashers.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; Check that we don't crash on corner cases.
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=1 -unroll-max-percent-threshold-boost=200 -o /dev/null
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=1 -unroll-max-percent-threshold-boost=200 -o /dev/null
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=1 -unroll-max-percent-threshold-boost=200 -o /dev/null
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=12 -unroll-max-percent-threshold-boost=400 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=12 -unroll-max-percent-threshold-boost=400 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=12 -unroll-max-percent-threshold-boost=400 | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=100 -unroll-threshold=10 -unroll-max-percent-threshold-boost=200 | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/LoopUnroll/full-unroll-heuristics.ll
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
; optimizations to remove ~55% of the instructions, the loop body size is 9,
; and unrolled size is 65.

; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST1
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=200 | FileCheck %s -check-prefix=TEST2
; RUN: opt < %s -S -loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST3
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST1
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=200 | FileCheck %s -check-prefix=TEST2
; RUN: opt < %s -S -passes=loop-unroll -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST3

; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=10 -unroll-max-percent-threshold-boost=100 | FileCheck %s -check-prefix=TEST1
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=1000 -unroll-threshold=20 -unroll-max-percent-threshold-boost=200 | FileCheck %s -check-prefix=TEST2
Expand All @@ -40,7 +40,7 @@
; TEST3: %array_const_idx = getelementptr inbounds [9 x i32], [9 x i32]* @known_constant, i64 0, i64 %iv

; And check that we don't crash when we're not allowed to do any analysis.
; RUN: opt < %s -loop-unroll -unroll-max-iteration-count-to-analyze=0 -disable-output
; RUN: opt < %s -passes=loop-unroll -unroll-max-iteration-count-to-analyze=0 -disable-output
; RUN: opt < %s -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-max-iteration-count-to-analyze=0 -disable-output
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/full-unroll-invariant.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-threshold=1 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=1 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' -unroll-threshold=1 | FileCheck %s

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -loop-unroll < %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll < %s | FileCheck %s
; RUN: opt -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' < %s | FileCheck %s

; Unroll twice, with first loop exit kept
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -loop-unroll %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll %s | FileCheck %s

; In both cases, we have one unpredictable exit and one IV-based exit with
; known trip count. We can fully unroll against the latter. In one of the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -S -unroll-runtime -loop-unroll < %s | FileCheck %s
; RUN: opt -S -unroll-runtime -passes=loop-unroll < %s | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; REQUIRES: asserts
; RUN: opt < %s -disable-output -stats -loop-unroll -info-output-file - | FileCheck %s --check-prefix=STATS
; RUN: opt < %s -disable-output -stats -passes=loop-unroll -info-output-file - | FileCheck %s --check-prefix=STATS
; STATS: 1 loop-unroll - Number of loops unrolled (completely or otherwise)
; Test that llvm.annotation intrinsic do not count against the loop body size
; and prevent unrolling.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/invalidate_right_loop.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -indvars -loop-unroll -verify-dom-info | FileCheck %s
; RUN: opt < %s -S -passes='loop(indvars),loop-unroll' -verify-dom-info | FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/loop-remarks-with-hotness.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -pass-remarks-with-hotness -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s
; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -pass-remarks-with-hotness -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s
; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -pass-remarks-with-hotness -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s
; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -pass-remarks-with-hotness -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s

; COMPLETE-UNROLL: remark: {{.*}}: completely unrolled loop with 16 iterations (hotness: 300)
; PARTIAL-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4 (hotness: 300)
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/Transforms/LoopUnroll/loop-remarks.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s
; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s
; RUN: opt < %s -S -loop-unroll -pass-remarks=loop-unroll -unroll-count=4 -unroll-runtime=true -unroll-remainder 2>&1 | FileCheck %s --check-prefix=RUNTIME-UNROLL
; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -unroll-count=16 2>&1 | FileCheck -check-prefix=COMPLETE-UNROLL %s
; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -unroll-count=4 2>&1 | FileCheck -check-prefix=PARTIAL-UNROLL %s
; RUN: opt < %s -S -passes=loop-unroll -pass-remarks=loop-unroll -unroll-count=4 -unroll-runtime=true -unroll-remainder 2>&1 | FileCheck %s --check-prefix=RUNTIME-UNROLL

; COMPLETE-UNROLL: remark: {{.*}}: completely unrolled loop with 16 iterations
; PARTIAL-UNROLL: remark: {{.*}}: unrolled loop by a factor of 4
Expand Down Expand Up @@ -45,4 +45,4 @@ for.end: ; preds = %for.body
ret i32 %add1
}

declare i32 @baz(i32)
declare i32 @baz(i32)
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/multiple-exits.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S < %s | FileCheck %s

declare void @bar()

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/noalias.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -loop-unroll -unroll-count=4 < %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll -unroll-count=4 < %s | FileCheck %s

define void @test_inside(i32* %addr1, i32* %addr2) {
; CHECK-LABEL: @test_inside(
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/nonlatchcondbr.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -loop-unroll -unroll-runtime -unroll-count=4 -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -unroll-runtime -unroll-count=4 -S | FileCheck %s
; RUN: opt < %s -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime -unroll-count=4 -S | FileCheck %s

; Check that loop unroll pass correctly handle loops with
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/not-rotated.ll
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; and another bb outside of the loop. This case is not
; properly handled by LoopUnroll, currently.

; RUN: opt -loop-unroll -verify-dom-info %s
; RUN: opt -passes=loop-unroll -verify-dom-info %s
; REQUIRES: asserts

define void @tinkywinky(i1 %patatino) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/optsize-loop-size.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S < %s | FileCheck %s

define i32 @test(i32 %a, i32 %b, i32 %c) optsize {
; CHECK-LABEL: @test(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -unroll-partial-threshold=20 -unroll-threshold=20 -loop-unroll -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s
; RUN: opt < %s -S -unroll-partial-threshold=20 -unroll-threshold=20 -passes=loop-unroll -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-partial-threshold=20 -unroll-threshold=20 -unroll-allow-partial -unroll-runtime -unroll-allow-remainder -unroll-max-percent-threshold-boost=100 | FileCheck %s
;
; Also check that the simple unroller doesn't allow the partial unrolling.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -S < %s -loop-unroll -unroll-allow-partial=1 | FileCheck %s
; RUN: opt -S < %s -passes=loop-unroll -unroll-allow-partial=1 | FileCheck %s
;
; Bugpointed test that triggered UB while cleaning up dead
; instructions after simplifying indvars
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -loop-unroll -unroll-allow-partial %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll -unroll-allow-partial %s | FileCheck %s

; This is a variant on full-unroll-non-latch-exit.ll for partial unrolling.
; This test is primarily interested in making sure that latches are not
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -unroll-allow-partial -S %s -verify-loop-info -verify-dom-info -verify-loop-lcssa | FileCheck %s
; RUN: opt -passes=loop-unroll -unroll-allow-partial -S %s -verify-loop-info -verify-dom-info -verify-loop-lcssa | FileCheck %s

@table = internal unnamed_addr global [344 x i32] zeroinitializer, align 16

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/peel-branch-weights.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=2 2>&1 | FileCheck %s
; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=2 -disable-advanced-peeling 2>&1 | FileCheck %s --check-prefix=DISABLEADV
; RUN: opt < %s -S -passes=loop-unroll -unroll-force-peel-count=2 2>&1 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-force-peel-count=2 -disable-advanced-peeling 2>&1 | FileCheck %s --check-prefix=DISABLEADV

declare i32 @get.x()

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop-and-unroll.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: not opt -loop-unroll -unroll-peel-count=2 -unroll-count=2 -S < %s 2>&1 | FileCheck %s
; RUN: not opt -passes=loop-unroll -unroll-peel-count=2 -unroll-count=2 -S < %s 2>&1 | FileCheck %s

; CHECK: LLVM ERROR: Cannot specify both explicit peel count and explicit unroll count

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -loop-unroll -verify-dom-info -debug-only=loop-unroll -unroll-peel-max-count=7 2>&1 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll,loop-unroll -verify-dom-info -debug-only=loop-unroll -unroll-peel-max-count=7 2>&1 | FileCheck %s
; REQUIRES: asserts

declare void @f1()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -loop-unroll -verify-dom-info -debug-only=loop-unroll -unroll-peel-max-count=7 2>&1 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -passes=loop-unroll -verify-dom-info -debug-only=loop-unroll -unroll-peel-max-count=7 2>&1 | FileCheck %s
; REQUIRES: asserts

declare void @f1()
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-peel-max-count=4 -verify-dom-info | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-peel-max-count=4 -verify-dom-info | FileCheck %s

declare void @f1()
declare void @f2()
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop-irreducible.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=1 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-force-peel-count=1 | FileCheck %s

define i32 @invariant_backedge_irreducible(i32 %a, i32 %b) {
; CHECK-LABEL: @invariant_backedge_irreducible(
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop-negative.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-threshold=800 -unroll-peel-max-count=0 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=800 -unroll-peel-max-count=0 | FileCheck %s

; We should not peel this loop even though we can, because the max count is set
; to zero.
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/peel-loop-nests.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-peel-max-count=4 -verify-dom-info | FileCheck %s
; RUN: opt < %s -S -loop-unroll -unroll-peel-max-count=4 -unroll-allow-loop-nests-peeling -verify-dom-info | FileCheck %s --check-prefix PEELED
; RUN: opt < %s -S -passes=loop-unroll -unroll-peel-max-count=4 -verify-dom-info | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-peel-max-count=4 -unroll-allow-loop-nests-peeling -verify-dom-info | FileCheck %s --check-prefix PEELED

declare void @f1()
declare void @f2()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=1 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-force-peel-count=1 | FileCheck %s
; RUN: opt < %s -S -passes='loop-unroll<peeling;no-runtime>' -unroll-force-peel-count=1 | FileCheck %s

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/peel-loop-not-forced.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt < %s -S -loop-unroll -unroll-threshold=30 | FileCheck %s
; RUN: opt < %s -S -loop-unroll -unroll-threshold=30 -unroll-allow-peeling=false | FileCheck %s --check-prefix=DISABLE
; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=30 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=30 -unroll-allow-peeling=false | FileCheck %s --check-prefix=DISABLE

define i32 @invariant_backedge_1(i32 %a, i32 %b) {
; CHECK-LABEL: @invariant_backedge_1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; REQUIRES: asserts
; RUN: opt < %s -S -debug-only=loop-unroll -loop-unroll -unroll-runtime 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes=loop-unroll -unroll-runtime 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,loop-unroll)' 2>&1 | FileCheck %s

; Regression test for setting the correct idom for exit blocks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; REQUIRES: asserts
; RUN: opt < %s -S -debug-only=loop-unroll -loop-unroll -unroll-runtime 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes=loop-unroll -unroll-runtime 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,loop-unroll)' 2>&1 | FileCheck %s

; Regression test for setting the correct idom for exit blocks.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; REQUIRES: asserts
; RUN: opt < %s -S -debug-only=loop-unroll -loop-unroll -unroll-runtime 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes=loop-unroll -unroll-runtime 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,loop-unroll)' 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,loop-unroll<no-profile-peeling>)' 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PEEL

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop-pgo.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -debug-only=loop-unroll -loop-unroll 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes=loop-unroll 2>&1 | FileCheck %s
; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,loop-unroll)' 2>&1 | FileCheck %s
; Confirm that peeling is disabled if the number of counts required to reach
; the hot percentile is above the threshold.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=1 -verify-scev -verify-dom-info | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-force-peel-count=1 -verify-scev -verify-dom-info | FileCheck %s


define void @test1(i32 %k) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-force-peel-count=3 -verify-dom-info -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -instcombine | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll,simplifycfg,instcombine -unroll-force-peel-count=3 -verify-dom-info -simplifycfg-require-and-preserve-domtree=1 | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll,simplifycfg,instcombine' -unroll-force-peel-count=3 -verify-dom-info | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll<peeling;no-runtime>,simplifycfg,instcombine' -unroll-force-peel-count=3 -verify-dom-info | FileCheck %s

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/peel-loop2.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -S -loop-unroll -unroll-force-peel-count=1 -verify-dom-info <%s
; RUN: opt -S -passes=loop-unroll -unroll-force-peel-count=1 -verify-dom-info <%s

; Check if loop composed of several BBs is peeled correctly.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S %s | FileCheck %s

declare void @foo()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S %s | FileCheck %s

declare void @foo()

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr10813.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -loop-unroll -disable-output
; RUN: opt < %s -passes=loop-unroll -disable-output

define void @"f_fu___REFUf[]REFUf[]Uf"() nounwind {
allocas:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr11361.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -disable-output < %s
; RUN: opt -passes=loop-unroll -disable-output < %s
; PR11361

; This tests for an iterator invalidation issue.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr14167.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-runtime | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime | FileCheck %s
target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
target triple = "powerpc64le-unknown-linux"

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr18861.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -loop-unroll -indvars -disable-output
; RUN: opt < %s -passes=loop-unroll,indvars -disable-output

@b = external global i32, align 4

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr27157.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -debug-only=loop-unroll -disable-output < %s
; RUN: opt -passes=loop-unroll -debug-only=loop-unroll -disable-output < %s
; REQUIRES: asserts
; Compile this test with debug flag on to verify domtree right after loop unrolling.
target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr28132.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S < %s | FileCheck %s
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i686-pc-windows-msvc"

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr31718.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -verify-loop-lcssa -S < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -verify-loop-lcssa -S < %s | FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/pr33437.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -loop-unroll -unroll-peel-count=1 < %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll -unroll-peel-count=1 < %s | FileCheck %s

declare zeroext i8 @patatino()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -unroll-peel-count=2 -S %s | FileCheck --check-prefix=PEEL2 %s
; RUN: opt -loop-unroll -unroll-peel-count=8 -S %s | FileCheck --check-prefix=PEEL8 %s
; RUN: opt -passes=loop-unroll -unroll-peel-count=2 -S %s | FileCheck --check-prefix=PEEL2 %s
; RUN: opt -passes=loop-unroll -unroll-peel-count=8 -S %s | FileCheck --check-prefix=PEEL8 %s

; Test case for PR45939. Make sure unroll count is adjusted when loop is peeled and unrolled.

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/rebuild_lcssa.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -loop-unroll -verify-loop-lcssa -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -verify-loop-lcssa -S | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

; This test shows how unrolling an inner loop could break LCSSA for an outer
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/revert-D110922.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; ModuleID = 'reduced.ll'
; RUN: opt < %s -loop-unroll -verify-loop-lcssa -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -verify-loop-lcssa -S | FileCheck %s

source_filename = "reduced.ll"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -loop-unroll -unroll-runtime -unroll-runtime-epilog -S %s | FileCheck %s
; RUN: opt -passes=loop-unroll -unroll-runtime -unroll-runtime-epilog -S %s | FileCheck %s

; Test that epilogue is tagged with the same debug information as original loop body rather than original loop exit.

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/runtime-li.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -S -loop-unroll -unroll-runtime -unroll-count=2 -verify-loop-info -pass-remarks=loop-unroll < %s 2>&1 | FileCheck %s
; RUN: opt -S -passes=loop-unroll -unroll-runtime -unroll-count=2 -verify-loop-info -pass-remarks=loop-unroll < %s 2>&1 | FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-other-exit-predictable=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s --check-prefix=ENABLED
; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-other-exit-predictable=false -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s --check-prefix=DISABLED
; RUN: opt < %s -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-other-exit-predictable=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s --check-prefix=ENABLED
; RUN: opt < %s -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-other-exit-predictable=false -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s --check-prefix=DISABLED

define i32 @test(i32* nocapture %a, i64 %n) {
; ENABLED-LABEL: @test(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-count=4 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-count=4 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-count=4 | FileCheck %s

;; Check that the remainder loop is properly assigned a branch weight for its latch branch.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/runtime-loop-known-exit.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -loop-unroll -unroll-runtime -unroll-runtime-multi-exit < %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll -unroll-runtime -unroll-runtime-multi-exit < %s | FileCheck %s

; This loop has a known trip count on the non-latch exit. When performing
; runtime unrolling (at least when using a prologue rather than epilogue) we
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false -unroll-runtime-multi-exit=true -unroll-count=4 -verify-dom-info -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false -unroll-runtime-multi-exit=true -unroll-count=4 -verify-dom-info -S | FileCheck %s

; REQUIRES: asserts
; The tests below are for verifying dom tree after runtime unrolling
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p
; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,EPILOG
; RUN: opt < %s -loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,EPILOG-BLOCK
; RUN: opt < %s -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,PROLOG
; RUN: opt < %s -loop-unroll -unroll-runtime -unroll-runtime-epilog=false -unroll-count=2 -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,PROLOG-BLOCK
; RUN: opt < %s -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,EPILOG
; RUN: opt < %s -passes=loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,EPILOG-BLOCK
; RUN: opt < %s -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,PROLOG
; RUN: opt < %s -passes=loop-unroll -unroll-runtime -unroll-runtime-epilog=false -unroll-count=2 -unroll-runtime-multi-exit=true -verify-loop-lcssa -verify-dom-info -verify-loop-info -S | FileCheck %s -check-prefixes=CHECK,PROLOG-BLOCK

; REQUIRES: asserts

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; REQUIRES: asserts
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-allow-remainder=true -unroll-count=4
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-allow-remainder=true -unroll-count=4

; Make sure that the runtime unroll does not break with a non-exiting latch.
define i32 @test(i32* %a, i32* %b, i32* %c, i64 %n) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/runtime-loop.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
;
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime=true -unroll-runtime-epilog=true | FileCheck %s -check-prefixes=EPILOG,COMMON
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime=true -unroll-runtime-epilog=false | FileCheck %s -check-prefixes=PROLOG,COMMON
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/LoopUnroll/runtime-loop1.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG

; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime -unroll-count=2 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
Expand Down Expand Up @@ -72,4 +72,4 @@ for.end: ; preds = %for.body, %entry
!11 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
file: !5,
isOptimized: true, flags: "-O2",
splitDebugFilename: "abc.debug", emissionKind: 2)
splitDebugFilename: "abc.debug", emissionKind: 2)
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/runtime-loop2.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt < %s -S -loop-unroll -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=true -unroll-count=8 | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -loop-unroll -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=true -unroll-count=8 | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG

; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=true -unroll-count=8 | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-threshold=25 -unroll-partial-threshold=25 -unroll-runtime -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/runtime-loop3.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; REQUIRES: asserts
; RUN: opt < %s -disable-output -stats -loop-unroll -unroll-runtime -unroll-partial-threshold=200 -unroll-threshold=400 -info-output-file - | FileCheck %s --check-prefix=STATS
; RUN: opt < %s -disable-output -stats -passes=loop-unroll -unroll-runtime -unroll-partial-threshold=200 -unroll-threshold=400 -info-output-file - | FileCheck %s --check-prefix=STATS
; RUN: opt < %s -disable-output -stats -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime -unroll-partial-threshold=200 -unroll-threshold=400 -info-output-file - | FileCheck %s --check-prefix=STATS

; Test that nested loops can be unrolled. We need to increase threshold to do it
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/runtime-loop5.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-count=16 | FileCheck --check-prefix=UNROLL-16 %s
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-count=4 | FileCheck --check-prefix=UNROLL-4 %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-count=16 | FileCheck --check-prefix=UNROLL-16 %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-count=4 | FileCheck --check-prefix=UNROLL-4 %s

; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime=true -unroll-count=16 | FileCheck --check-prefix=UNROLL-16 %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll' -unroll-runtime=true -unroll-count=4 | FileCheck --check-prefix=UNROLL-4 %s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -unroll-runtime-other-exit-predictable=false -loop-unroll -unroll-runtime=true -verify-dom-info -verify-loop-info -instcombine -S | FileCheck %s
; RUN: opt < %s -unroll-runtime-other-exit-predictable=false -loop-unroll -unroll-runtime=true -verify-dom-info -unroll-runtime-multi-exit=false -verify-loop-info -S | FileCheck %s -check-prefix=NOUNROLL
; RUN: opt < %s -unroll-runtime-other-exit-predictable=false -loop-unroll -unroll-runtime=true -verify-dom-info -unroll-runtime-multi-exit=true -verify-loop-info -S | FileCheck %s -check-prefix=ENABLED
; RUN: opt < %s -unroll-runtime-other-exit-predictable=false -passes=loop-unroll,instcombine -unroll-runtime=true -verify-dom-info -verify-loop-info -S | FileCheck %s
; RUN: opt < %s -unroll-runtime-other-exit-predictable=false -passes=loop-unroll -unroll-runtime=true -verify-dom-info -unroll-runtime-multi-exit=false -verify-loop-info -S | FileCheck %s -check-prefix=NOUNROLL
; RUN: opt < %s -unroll-runtime-other-exit-predictable=false -passes=loop-unroll -unroll-runtime=true -verify-dom-info -unroll-runtime-multi-exit=true -verify-loop-info -S | FileCheck %s -check-prefix=ENABLED

; The purpose of these tests is to exercise the heuristics which decide whether
; to unroll multiple exit loops - specifically, the multiple exit reasoning.
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/runtime-small-upperbound.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -loop-unroll -unroll-runtime %s -o - | FileCheck %s
; RUN: opt -S -loop-unroll -unroll-runtime -unroll-max-upperbound=6 %s -o - | FileCheck %s --check-prefix=UPPER
; RUN: opt -S -passes=loop-unroll -unroll-runtime %s -o - | FileCheck %s
; RUN: opt -S -passes=loop-unroll -unroll-runtime -unroll-max-upperbound=6 %s -o - | FileCheck %s --check-prefix=UPPER

target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-count=2 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime=true -unroll-runtime-epilog=true -unroll-count=2 | FileCheck %s

; Make sure the loop is unrolled without a remainder loop based on an assumption
; that the least significant bit is known to be zero.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-runtime=true -unroll-count=4 -unroll-remainder -instcombine | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll,instcombine -unroll-runtime=true -unroll-count=4 -unroll-remainder | FileCheck %s

define i32 @unroll(i32* nocapture readonly %a, i32* nocapture readonly %b, i32 %N) local_unnamed_addr #0 {
;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/scevunroll.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -indvars -loop-unroll -verify-loop-info | FileCheck %s
; RUN: opt < %s -S -passes='loop(indvars),loop-unroll' -verify-loop-info | FileCheck %s
;
; Unit tests for loop unrolling using ScalarEvolution to compute trip counts.
;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/shifted-tripcount.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -loop-unroll -unroll-count=2 -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -unroll-count=2 -S | FileCheck %s

; LoopUnroll should unroll this loop into one big basic block.
define void @latch_exit(double* nocapture %p, i64 %n) nounwind {
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/tripcount-overflow.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -unroll-runtime -unroll-count=2 -loop-unroll -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -unroll-runtime -unroll-count=2 -loop-unroll -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
; RUN: opt < %s -S -unroll-runtime -unroll-count=2 -passes=loop-unroll -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
; RUN: opt < %s -S -unroll-runtime -unroll-count=2 -passes=loop-unroll -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

; This test case documents how runtime loop unrolling handles the case
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/unloop.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -verify-loop-info | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -verify-loop-info | FileCheck %s
; RUN: opt < %s -S -passes='require<opt-remark-emit>,loop-unroll,verify<loops>' | FileCheck %s
;
; Unit tests for LoopInfo::markAsRemoved.
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/unroll-cleanuppad.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -S -loop-unroll %s | FileCheck %s
; RUN: opt -S -passes=loop-unroll %s | FileCheck %s
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc18.0.0"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S -unroll-threshold=120 -unroll-max-iteration-count-to-analyze=100 < %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S -unroll-threshold=120 -unroll-max-iteration-count-to-analyze=100 < %s | FileCheck %s

; TODO: None of the if.false blocks are reachable, it would be nice if
; the output of unrolling made this obvious and didn't rely on other
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/unroll-count.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-count=2 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-count=2 | FileCheck %s
; Checks that "llvm.loop.unroll.disable" is set when
; unroll with count set by user has been applied.
;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S %s | FileCheck %s
; RUN: opt -passes=loop-unroll -S %s | FileCheck %s

; Loop with multiple exiting blocks, where the header exits but not the latch,
; e.g. because it has not been rotated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -loop-unroll -unroll-allow-partial | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-allow-partial | FileCheck %s

; The phi which acts as input to func should not be undef. It should
; have its loop-carried value (the load in for.cond) replaced accordingly
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/unroll-heuristics-pgo.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-threshold=40 -unroll-max-percent-threshold-boost=100 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-runtime -unroll-threshold=40 -unroll-max-percent-threshold-boost=100 | FileCheck %s

@known_constant = internal unnamed_addr constant [9 x i32] [i32 0, i32 -1, i32 0, i32 -1, i32 5, i32 -1, i32 0, i32 -1, i32 0], align 16

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/unroll-maxcount.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -S -loop-unroll -unroll-allow-partial -unroll-max-count=1 | FileCheck %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-allow-partial -unroll-max-count=1 | FileCheck %s
; Checks that unroll MaxCount is honored.
;
; CHECK-LABEL: @foo(
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt < %s -S -loop-unroll -unroll-count=4 | FileCheck -check-prefix=CHECK_COUNT4 %s
; RUN: opt < %s -S -loop-unroll | FileCheck -check-prefix=CHECK_NOCOUNT %s
; RUN: opt < %s -S -passes=loop-unroll -unroll-count=4 | FileCheck -check-prefix=CHECK_COUNT4 %s
; RUN: opt < %s -S -passes=loop-unroll | FileCheck -check-prefix=CHECK_NOCOUNT %s
; RUN: opt < %s -S -passes='require<profile-summary>,function(loop-unroll)' -pgso | FileCheck -check-prefix=PGSO %s
; RUN: opt < %s -S -passes='require<profile-summary>,function(loop-unroll)' -pgso=false | FileCheck -check-prefix=NPGSO %s

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/unroll-pragmas-disabled.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt < %s -loop-unroll -S | FileCheck %s
; RUN: opt < %s -passes=loop-unroll -S | FileCheck %s
;
; Verify that the unrolling pass removes existing unroll count metadata
; and adds a disable unrolling node after unrolling is complete.
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/LoopUnroll/unroll-pragmas.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt < %s -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s
; RUN: opt < %s -loop-unroll -loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s
; RUN: opt < %s -loop-unroll -unroll-allow-remainder=0 -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,NOREM %s
; RUN: opt < %s -passes=loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s
; RUN: opt < %s -passes=loop-unroll -passes=loop-unroll -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,REM %s
; RUN: opt < %s -passes=loop-unroll -unroll-allow-remainder=0 -pragma-unroll-threshold=1024 -S | FileCheck -check-prefixes=CHECK,NOREM %s
;
; Run loop unrolling twice to verify that loop unrolling metadata is properly
; removed and further unrolling is disabled after the pass is run once.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -loop-unroll -S %s -verify-loop-info -verify-dom-info -verify-loop-lcssa | FileCheck %s
; RUN: opt -passes=loop-unroll -S %s -verify-loop-info -verify-dom-info -verify-loop-lcssa | FileCheck %s

%struct.spam = type { double, double, double, double, double, double, double }

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/LoopUnroll/wrong_assert_in_peeling.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S < %s -loop-unroll | FileCheck %s
; RUN: opt -S < %s -passes=loop-unroll | FileCheck %s
; RUN: opt -S < %s -passes=loop-unroll | FileCheck %s
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
5 changes: 4 additions & 1 deletion llvm/test/tools/llvm-exegesis/AArch64/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import subprocess
import lit.util

if not ('AArch64' in config.root.targets):
if 'native' not in config.available_features:
config.unsupported = True

elif not ('AArch64' in config.root.targets):
# We need support for AArch64.
config.unsupported = True

Expand Down
5 changes: 4 additions & 1 deletion llvm/test/tools/llvm-exegesis/Mips/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import subprocess
import lit.util

if not ('Mips' in config.root.targets):
if 'native' not in config.available_features:
config.unsupported = True

elif not ('Mips' in config.root.targets):
# We need support for Mips.
config.unsupported = True

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=ADD8 | FileCheck %s
# RUN: llvm-exegesis -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 --skip-measurements -mode=latency -opcode-name=ADD8 | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
26 changes: 0 additions & 26 deletions llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
import subprocess
import lit.util

if not ('PowerPC' in config.root.targets):
# We need support for PowerPC.
config.unsupported = True

elif not ('powerpc' in config.root.host_triple):
# We need to be running on an PPC host.
config.unsupported = True

else:
# We need libpfm to be installed and allow reading perf counters. We can
# only know that at runtime, so we try to measure the latency of an empty
# code snippet and bail out on error.
llvm_exegesis_exe = lit.util.which('llvm-exegesis', config.llvm_tools_dir)
if not llvm_exegesis_exe:
print('llvm-exegesis not found')
config.unsupported = True
else:
try:
with open(os.devnull, 'w') as quiet:
check_llvm_exegesis_result = subprocess.call(
[llvm_exegesis_exe, '-mode', 'latency', '-snippets-file', '/dev/null'], stdout=quiet, stderr=quiet)
except OSError:
print('could not exec llvm-exegesis')
config.unsupported = True
if not check_llvm_exegesis_result == 0:
config.unsupported = True
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=SELECT_I8 2>&1 | FileCheck %s
# RUN: llvm-exegesis -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 --skip-measurements -mode=latency -opcode-name=SELECT_I8 2>&1 | FileCheck %s

CHECK: Unsupported opcode: isPseudo/usesCustomInserter
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# RUN: llvm-exegesis -mode=analysis -benchmarks-file=%s -analysis-clusters-output-file=- -analysis-clustering-epsilon=0.1 -analysis-inconsistency-epsilon=0.1 -analysis-numpoints=1 -analysis-clustering=naive | FileCheck -check-prefixes=CHECK-CLUSTERS %s

# https://bugs.llvm.org/show_bug.cgi?id=41448
# Verify that deserialization works. Since CMOV16rm has a variant sched class, just printing clusters is sufficient

---
mode: uops
key:
instructions:
- 'CMOV16rm AX AX RDI i_0x1 %noreg i_0x0 %noreg i_0x0'
- 'CMOV16rm BP BP RDI i_0x1 %noreg i_0x40 %noreg i_0x0'
- 'CMOV16rm BX BX RDI i_0x1 %noreg i_0x80 %noreg i_0x0'
- 'CMOV16rm CX CX RDI i_0x1 %noreg i_0xc0 %noreg i_0x0'
- 'CMOV16rm DX DX RDI i_0x1 %noreg i_0x100 %noreg i_0x0'
- 'CMOV16rm SI SI RDI i_0x1 %noreg i_0x140 %noreg i_0x0'
- 'CMOV16rm R8W R8W RDI i_0x1 %noreg i_0x180 %noreg i_0x0'
- 'CMOV16rm R9W R9W RDI i_0x1 %noreg i_0x1c0 %noreg i_0x0'
- 'CMOV16rm R10W R10W RDI i_0x1 %noreg i_0x200 %noreg i_0x0'
- 'CMOV16rm R11W R11W RDI i_0x1 %noreg i_0x240 %noreg i_0x0'
- 'CMOV16rm R12W R12W RDI i_0x1 %noreg i_0x280 %noreg i_0x0'
- 'CMOV16rm R13W R13W RDI i_0x1 %noreg i_0x2c0 %noreg i_0x0'
- 'CMOV16rm R14W R14W RDI i_0x1 %noreg i_0x300 %noreg i_0x0'
- 'CMOV16rm R15W R15W RDI i_0x1 %noreg i_0x340 %noreg i_0x0'
config: ''
register_initial_values:
- 'AX=0x0'
- 'EFLAGS=0x0'
- 'BP=0x0'
- 'BX=0x0'
- 'CX=0x0'
- 'DX=0x0'
- 'SI=0x0'
- 'R8W=0x0'
- 'R9W=0x0'
- 'R10W=0x0'
- 'R11W=0x0'
- 'R12W=0x0'
- 'R13W=0x0'
- 'R14W=0x0'
- 'R15W=0x0'
cpu_name: znver3
llvm_triple: x86_64-pc-linux-gnu
num_repetitions: 10000
measurements:
- { key: Zn3Int, value: 1.0161, per_snippet_value: 14.2254 }
- { key: Zn3FPU, value: 0, per_snippet_value: 0 }
- { key: Zn3Load, value: 1.003, per_snippet_value: 14.042 }
- { key: Zn3Store, value: 0.0023, per_snippet_value: 0.0322 }
- { key: Zn3Divider, value: 0, per_snippet_value: 0 }
- { key: NumMicroOps, value: 1.0146, per_snippet_value: 14.2044 }
error: ''
info: instruction has tied variables, using static renaming.
assembled_snippet: 5541574156415541545366B800004883EC08C7042400000000C7442404000000009D66BD000066BB000066B9000066BA000066BE00006641B800006641B900006641BA00006641BB00006641BC00006641BD00006641BE00006641BF0000660F4007660F406F40660F409F80000000660F408FC0000000660F409700010000660F40B74001000066440F40878001000066440F408FC001000066440F40970002000066440F409F4002000066440F40A78002000066440F40AFC002000066440F40B70003000066440F40BF40030000660F4007660F406F40660F409F80000000660F408FC0000000660F409700010000660F40B74001000066440F40878001000066440F408FC001000066440F40970002000066440F409F4002000066440F40A78002000066440F40AFC002000066440F40B70003000066440F40BF40030000660F4007660F406F40660F409F80000000660F408FC0000000660F409700010000660F40B74001000066440F40878001000066440F408FC001000066440F40970002000066440F409F4002000066440F40A78002000066440F40AFC002000066440F40B70003000066440F40BF40030000660F4007660F406F40660F409F80000000660F408FC0000000660F409700010000660F40B74001000066440F40878001000066440F408FC001000066440F40970002000066440F409F4002000066440F40A78002000066440F40AFC002000066440F40B70003000066440F40BF400300005B415C415D415E415F5DC3
...


# CHECK-CLUSTERS: {{^}}cluster_id,opcode_name,config,sched_class,
# CHECK-CLUSTERS-NEXT: {{^}}0,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: llvm-exegesis -mcpu=znver3 -mode=analysis -benchmarks-file=%s -analysis-clusters-output-file=- -analysis-clustering-epsilon=0.1 -analysis-inconsistency-epsilon=0.1 -analysis-numpoints=1 -analysis-clustering=naive | FileCheck -check-prefixes=CHECK-CLUSTERS %s
# RUN: llvm-exegesis -mode=analysis -benchmarks-file=%s -analysis-clusters-output-file=- -analysis-clustering-epsilon=0.1 -analysis-inconsistency-epsilon=0.1 -analysis-numpoints=1 -analysis-clustering=naive | FileCheck -check-prefixes=CHECK-CLUSTERS %s

# Naive clusterization mainly groups by instruction opcode,
# but it should also partition the benchmarks of the same opcode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# RUN: llvm-exegesis -mode=inverse_throughput -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=inverse_throughput -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=inverse_throughput --skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: inverse_throughput
CHECK-NEXT: key:
CHECK-NEXT: instructions:
CHECK-NEXT: ADD32rr
CHECK: key: inverse_throughput
29 changes: 0 additions & 29 deletions llvm/test/tools/llvm-exegesis/X86/inverse_throughput/lit.local.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/latency/latency-CMOV32rr.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=CMOV32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=latency -opcode-name=CMOV32rr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=CMOV32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=CMOV32rr -repetition-mode=loop | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-exegesis/X86/latency/latency-IN16rr.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=IN16rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=IN16rr -repetition-mode=duplicate | FileCheck %s

# FIXME: Sometimes fails with: 'unimplemented operand type'
# ALLOW_RETRIES: 2
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64_32r.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mode=latency -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64_32r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/latency/latency-LEA64r.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mode=latency -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/latency/latency-SBB8rr.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=SBB8rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=latency -opcode-name=SBB8rr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -repetition-mode=loop | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=SETCCr --max-configs-per-opcode=1 | FileCheck %s --check-prefix=CHECK
# RUN: llvm-exegesis -mode=latency -opcode-name=SETCCr --max-configs-per-opcode=256 | FileCheck %s --check-prefix=SWEEP
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SETCCr --max-configs-per-opcode=1 | FileCheck %s --check-prefix=CHECK
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SETCCr --max-configs-per-opcode=256 | FileCheck %s --check-prefix=SWEEP

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=SQRTSSr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SQRTSSr -repetition-mode=loop | FileCheck %s

# Check that the setup code for MXCSR does not crash the snippet.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=latency -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
29 changes: 0 additions & 29 deletions llvm/test/tools/llvm-exegesis/X86/latency/lit.local.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/latency/max-configs.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=latency -opcode-name=SBB8rr -max-configs-per-opcode=1 | FileCheck -check-prefixes=CHECK,CHECK1 %s
# RUN: llvm-exegesis -mode=latency -opcode-name=SBB8rr -max-configs-per-opcode=2 | FileCheck -check-prefixes=CHECK,CHECK2 %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -max-configs-per-opcode=1 | FileCheck -check-prefixes=CHECK,CHECK1 %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --skip-measurements -opcode-name=SBB8rr -max-configs-per-opcode=2 | FileCheck -check-prefixes=CHECK,CHECK2 %s

CHECK: ---
CHECK-NEXT: mode: latency
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/tools/llvm-exegesis/X86/lbr/Inputs/mov_add.att
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LLVM-EXEGESIS-LIVEIN RDI
# LLVM-EXEGESIS-DEFREG XMM1 42
# llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64-LIVEIN RDI
# llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64-DEFREG XMM1 42
movq $2, %rdi
addq $0x10, %rdi
addq $0x10, %rdi
9 changes: 6 additions & 3 deletions llvm/test/tools/llvm-exegesis/X86/lbr/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import subprocess
import lit.util

if not ('X86' in config.root.targets):
if 'native' not in config.available_features:
config.unsupported = True

elif not ('X86' in config.root.targets):
# We need support for X86.
config.unsupported = True

elif not ('x86_64' in config.root.host_triple):
# We need to be running on an X86 host.
config.unsupported = True
else:

else:
# We need libpfm to be installed and the host to be support LBR format with cycles.
llvm_exegesis_exe = lit.util.which('llvm-exegesis', config.llvm_tools_dir)
if not llvm_exegesis_exe:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-exegesis/X86/lbr/mov-add.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: llvm-exegesis -mode=latency --repetition-mode=loop --x86-lbr-sample-period=521 --snippets-file=%p/Inputs/mov_add.att
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=latency --repetition-mode=loop --x86-lbr-sample-period=521 --snippets-file=%p/Inputs/mov_add.att


CHECK: ---
Expand Down
4 changes: 0 additions & 4 deletions llvm/test/tools/llvm-exegesis/X86/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
if not ('X86' in config.root.targets):
# We need support for X86.
config.unsupported = True

elif not ('x86_64' in config.root.host_triple):
# We need to be running on an X86 host.
config.unsupported = True
29 changes: 0 additions & 29 deletions llvm/test/tools/llvm-exegesis/X86/uops/lit.local.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mi8.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32mi8 -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32mi8 -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mi8 -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mi8 -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32mr.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32mr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32mr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32mr -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD32rm.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32rm -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rm -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-ADD_F32m.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD_F32m -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD_F32m -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD_F32m -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD_F32m -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-BEXTR32rm.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=BEXTR32rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=BEXTR32rm -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BEXTR32rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BEXTR32rm -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-BSF16rm.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=BSF16rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=BSF16rm -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BSF16rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BSF16rm -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-BTR64mr.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=BTR64mr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=BTR64mr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BTR64mr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=BTR64mr -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=CMOV16rm -benchmarks-file=- | FileCheck %s -check-prefixes=CHECK-YAML

# https://bugs.llvm.org/show_bug.cgi?id=41448
# Verify that we correctly serialize RegNo 0 as %noreg, not as an empty string!

CHECK-YAML: ---
CHECK-YAML-NEXT: mode: uops
CHECK-YAML-NEXT: key:
CHECK-YAML-NEXT: instructions:
CHECK-YAML-NEXT: - 'CMOV16rm {{[A-Z0-9]+}} {{[A-Z0-9]+}} {{[A-Z0-9]+}} i_0x1 %noreg i_0x0 %noreg i_0x{{[0-9a-f]}}'
CHECK-YAML-LAST: ...
17 changes: 0 additions & 17 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-CMOV16rm-noreg.s

This file was deleted.

2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-exegesis/X86/uops/uops-FLDENVm.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=FLDENVm,FLDL2E -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=FLDENVm,FLDL2E -repetition-mode=duplicate | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-LEA64r.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=LEA64r -repetition-mode=duplicate -max-configs-per-opcode=2 | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=LEA64r -repetition-mode=loop -max-configs-per-opcode=2 | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: uops
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-exegesis/X86/uops/uops-POPCNT32rr.s
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=POPCNT32rr 2>&1 | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=POPCNT32rr 2>&1 | FileCheck %s

CHECK: ---
CHECK-NEXT: mode: uops
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-STD.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=STD -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=STD -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=STD -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=STD -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-VFMADDSS4rm.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=VFMADDSS4rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=VFMADDSS4rm -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=VFMADDSS4rm -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=VFMADDSS4rm -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-XCHG64rr.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=XCHG64rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=XCHG64rr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=XCHG64rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=XCHG64rr -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-by-opcode-name.s
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mode=uops -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rr -repetition-mode=duplicate | FileCheck %s
# RUN: llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -opcode-name=ADD32rr -repetition-mode=loop | FileCheck %s

CHECK: mode: uops
CHECK-NEXT: key:
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/tools/llvm-exegesis/X86/uops/uops-misspelled-div.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# RUN: not llvm-exegesis -mode=uops -snippets-file=%s 2>&1 | FileCheck %s
# RUN: not llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mode=uops --skip-measurements -snippets-file=%s 2>&1 | FileCheck %s

# LLVM-EXEGESIS-DEFREG CL 1
# LLVM-EXEGESIS-DEFREG AX 1
# llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64-DEFREG CL 1
# llvm-exegesis -mtriple=x86_64-unknown-unknown -mcpu=x86-64-DEFREG AX 1
div8r cl

CHECK: error: invalid instruction mnemonic 'div8r'
Expand Down
2 changes: 0 additions & 2 deletions llvm/test/tools/llvm-exegesis/lit.local.cfg

This file was deleted.

13 changes: 11 additions & 2 deletions llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ namespace llvm {
namespace exegesis {

BenchmarkRunner::BenchmarkRunner(const LLVMState &State,
InstructionBenchmark::ModeE Mode)
: State(State), Mode(Mode), Scratch(std::make_unique<ScratchSpace>()) {}
InstructionBenchmark::ModeE Mode,
bool BenchmarkSkipMeasurements)
: State(State), Mode(Mode),
BenchmarkSkipMeasurements(BenchmarkSkipMeasurements),
Scratch(std::make_unique<ScratchSpace>()) {}

BenchmarkRunner::~BenchmarkRunner() = default;

Expand Down Expand Up @@ -213,6 +216,12 @@ Expected<InstructionBenchmark> BenchmarkRunner::runConfiguration(
ObjectFile = getObjectFromBuffer(OS.str());
}

if (BenchmarkSkipMeasurements) {
InstrBenchmark.Error =
"in --skip-measurements mode, actual measurements skipped.";
continue;
}

const FunctionExecutorImpl Executor(State, std::move(ObjectFile),
Scratch.get());
auto NewMeasurements = runMeasurements(Executor);
Expand Down
4 changes: 3 additions & 1 deletion llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ namespace exegesis {
class BenchmarkRunner {
public:
explicit BenchmarkRunner(const LLVMState &State,
InstructionBenchmark::ModeE Mode);
InstructionBenchmark::ModeE Mode,
bool BenchmarkSkipMeasurements);

virtual ~BenchmarkRunner();

Expand Down Expand Up @@ -77,6 +78,7 @@ class BenchmarkRunner {
protected:
const LLVMState &State;
const InstructionBenchmark::ModeE Mode;
const bool BenchmarkSkipMeasurements;

private:
virtual Expected<std::vector<BenchmarkMeasure>>
Expand Down
3 changes: 2 additions & 1 deletion llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ namespace exegesis {

LatencyBenchmarkRunner::LatencyBenchmarkRunner(
const LLVMState &State, InstructionBenchmark::ModeE Mode,
bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE ResultAgg)
: BenchmarkRunner(State, Mode) {
: BenchmarkRunner(State, Mode, BenchmarkSkipMeasurements) {
assert((Mode == InstructionBenchmark::Latency ||
Mode == InstructionBenchmark::InverseThroughput) &&
"invalid mode");
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/llvm-exegesis/lib/LatencyBenchmarkRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class LatencyBenchmarkRunner : public BenchmarkRunner {
public:
LatencyBenchmarkRunner(
const LLVMState &State, InstructionBenchmark::ModeE Mode,
bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE ResultAggMode);
~LatencyBenchmarkRunner() override;

Expand Down
46 changes: 34 additions & 12 deletions llvm/tools/llvm-exegesis/lib/LlvmState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,55 @@
namespace llvm {
namespace exegesis {

Expected<LLVMState> LLVMState::Create(std::string Triple, std::string CpuName,
Expected<LLVMState> LLVMState::Create(std::string TripleName,
std::string CpuName,
const StringRef Features) {
if (Triple.empty())
Triple = sys::getProcessTriple();
if (CpuName.empty())
CpuName = sys::getHostCPUName().str();
if (TripleName.empty())
TripleName = Triple::normalize(sys::getDefaultTargetTriple());

Triple TheTriple(TripleName);

// Get the target specific parser.
std::string Error;
const Target *const TheTarget = TargetRegistry::lookupTarget(Triple, Error);
const Target *TheTarget =
TargetRegistry::lookupTarget(/*MArch=*/"", TheTriple, Error);
if (!TheTarget) {
return llvm::make_error<llvm::StringError>(
"no LLVM target for triple " + Triple, llvm::inconvertibleErrorCode());
return llvm::make_error<llvm::StringError>("no LLVM target for triple " +
TripleName,
llvm::inconvertibleErrorCode());
}

// Update Triple with the updated triple from the target lookup.
TripleName = TheTriple.str();

if (CpuName == "native")
CpuName = std::string(llvm::sys::getHostCPUName());

std::unique_ptr<MCSubtargetInfo> STI(
TheTarget->createMCSubtargetInfo(TripleName, CpuName, ""));
assert(STI && "Unable to create subtarget info!");
if (!STI->isCPUStringValid(CpuName)) {
return llvm::make_error<llvm::StringError>(Twine("invalid CPU name (")
.concat(CpuName)
.concat(") for triple ")
.concat(TripleName),
llvm::inconvertibleErrorCode());
}
const TargetOptions Options;
std::unique_ptr<const TargetMachine> TM(
static_cast<LLVMTargetMachine *>(TheTarget->createTargetMachine(
Triple, CpuName, Features, Options, Reloc::Model::Static)));
TripleName, CpuName, Features, Options, Reloc::Model::Static)));
if (!TM) {
return llvm::make_error<llvm::StringError>(
"unable to create target machine", llvm::inconvertibleErrorCode());
}

const ExegesisTarget *ET =
Triple.empty() ? &ExegesisTarget::getDefault()
: ExegesisTarget::lookup(TM->getTargetTriple());
TripleName.empty() ? &ExegesisTarget::getDefault()
: ExegesisTarget::lookup(TM->getTargetTriple());
if (!ET) {
return llvm::make_error<llvm::StringError>(
"no Exegesis target for triple " + Triple,
"no Exegesis target for triple " + TripleName,
llvm::inconvertibleErrorCode());
}
return LLVMState(std::move(TM), ET, CpuName);
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-exegesis/lib/LlvmState.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class LLVMState {
// If `Triple` is empty, uses the host triple.
// If `CpuName` is empty, uses the host CPU.
// `Features` is intended for tests.
static Expected<LLVMState> Create(std::string Triple, std::string CpuName,
static Expected<LLVMState> Create(std::string TripleName, std::string CpuName,
StringRef Features = "");

const TargetMachine &getTargetMachine() const { return *TheTargetMachine; }
Expand Down
32 changes: 22 additions & 10 deletions llvm/tools/llvm-exegesis/lib/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,37 @@ std::unique_ptr<SnippetGenerator> ExegesisTarget::createSnippetGenerator(
Expected<std::unique_ptr<BenchmarkRunner>>
ExegesisTarget::createBenchmarkRunner(
InstructionBenchmark::ModeE Mode, const LLVMState &State,
bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE ResultAggMode) const {
PfmCountersInfo PfmCounters = State.getPfmCounters();
switch (Mode) {
case InstructionBenchmark::Unknown:
return nullptr;
case InstructionBenchmark::Latency:
case InstructionBenchmark::InverseThroughput:
if (!PfmCounters.CycleCounter) {
if (!BenchmarkSkipMeasurements && !PfmCounters.CycleCounter) {
const char *ModeName = Mode == InstructionBenchmark::Latency
? "latency"
: "inverse_throughput";
return make_error<Failure>(
Twine("can't run '")
.concat(ModeName)
.concat("' mode, sched model does not define a cycle counter."));
.concat(
"' mode, sched model does not define a cycle counter. You "
"can pass --skip-measurements to skip the actual "
"benchmarking."));
}
return createLatencyBenchmarkRunner(State, Mode, ResultAggMode);
return createLatencyBenchmarkRunner(State, Mode, BenchmarkSkipMeasurements,
ResultAggMode);
case InstructionBenchmark::Uops:
if (!PfmCounters.UopsCounter && !PfmCounters.IssueCounters)
return make_error<Failure>("can't run 'uops' mode, sched model does not "
"define uops or issue counters.");
return createUopsBenchmarkRunner(State, ResultAggMode);
if (!BenchmarkSkipMeasurements && !PfmCounters.UopsCounter &&
!PfmCounters.IssueCounters)
return make_error<Failure>(
"can't run 'uops' mode, sched model does not define uops or issue "
"counters. You can pass --skip-measurements to skip the actual "
"benchmarking.");
return createUopsBenchmarkRunner(State, BenchmarkSkipMeasurements,
ResultAggMode);
}
return nullptr;
}
Expand All @@ -108,14 +117,17 @@ std::unique_ptr<SnippetGenerator> ExegesisTarget::createParallelSnippetGenerator

std::unique_ptr<BenchmarkRunner> ExegesisTarget::createLatencyBenchmarkRunner(
const LLVMState &State, InstructionBenchmark::ModeE Mode,
bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE ResultAggMode) const {
return std::make_unique<LatencyBenchmarkRunner>(State, Mode, ResultAggMode);
return std::make_unique<LatencyBenchmarkRunner>(
State, Mode, BenchmarkSkipMeasurements, ResultAggMode);
}

std::unique_ptr<BenchmarkRunner> ExegesisTarget::createUopsBenchmarkRunner(
const LLVMState &State,
const LLVMState &State, bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE /*unused*/) const {
return std::make_unique<UopsBenchmarkRunner>(State);
return std::make_unique<UopsBenchmarkRunner>(State,
BenchmarkSkipMeasurements);
}

static_assert(std::is_pod<PfmCountersInfo>::value,
Expand Down
4 changes: 3 additions & 1 deletion llvm/tools/llvm-exegesis/lib/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class ExegesisTarget {
// Creates a benchmark runner for the given mode.
Expected<std::unique_ptr<BenchmarkRunner>> createBenchmarkRunner(
InstructionBenchmark::ModeE Mode, const LLVMState &State,
bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE ResultAggMode =
InstructionBenchmark::Min) const;

Expand Down Expand Up @@ -193,9 +194,10 @@ class ExegesisTarget {
const LLVMState &State, const SnippetGenerator::Options &Opts) const;
std::unique_ptr<BenchmarkRunner> virtual createLatencyBenchmarkRunner(
const LLVMState &State, InstructionBenchmark::ModeE Mode,
bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE ResultAggMode) const;
std::unique_ptr<BenchmarkRunner> virtual createUopsBenchmarkRunner(
const LLVMState &State,
const LLVMState &State, bool BenchmarkSkipMeasurements,
InstructionBenchmark::ResultAggregationModeE ResultAggMode) const;

const ExegesisTarget *Next = nullptr;
Expand Down
5 changes: 3 additions & 2 deletions llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ namespace exegesis {

class UopsBenchmarkRunner : public BenchmarkRunner {
public:
UopsBenchmarkRunner(const LLVMState &State)
: BenchmarkRunner(State, InstructionBenchmark::Uops) {}
UopsBenchmarkRunner(const LLVMState &State, bool BenchmarkSkipMeasurements)
: BenchmarkRunner(State, InstructionBenchmark::Uops,
BenchmarkSkipMeasurements) {}
~UopsBenchmarkRunner() override;

static constexpr const size_t kMinNumDifferentAddresses = 6;
Expand Down
81 changes: 61 additions & 20 deletions llvm/tools/llvm-exegesis/llvm-exegesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetSelect.h"
Expand Down Expand Up @@ -87,7 +89,8 @@ static cl::opt<exegesis::InstructionBenchmark::ModeE> BenchmarkMode(
static cl::opt<exegesis::InstructionBenchmark::ResultAggregationModeE>
ResultAggMode(
"result-aggregation-mode",
cl::desc("How to aggregate multi-values result"), cl::cat(Options),
cl::desc("How to aggregate multi-values result"),
cl::cat(BenchmarkOptions),
cl::values(clEnumValN(exegesis::InstructionBenchmark::Min, "min",
"Keep min reading"),
clEnumValN(exegesis::InstructionBenchmark::Max, "max",
Expand All @@ -111,6 +114,11 @@ static cl::opt<exegesis::InstructionBenchmark::RepetitionModeE> RepetitionMode(
"All of the above and take the minimum of measurements")),
cl::init(exegesis::InstructionBenchmark::Duplicate));

static cl::opt<bool> BenchmarkSkipMeasurements(
"skip-measurements",
cl::desc("do everything except actually performing the measurements"),
cl::cat(BenchmarkOptions), cl::init(false));

static cl::opt<unsigned>
NumRepetitions("num-repetitions",
cl::desc("number of time to repeat the asm snippet"),
Expand Down Expand Up @@ -177,10 +185,23 @@ static cl::opt<bool> AnalysisDisplayUnstableOpcodes(
"instead show only such unstable opcodes"),
cl::cat(AnalysisOptions), cl::init(false));

static cl::opt<std::string> CpuName(
"mcpu",
cl::desc("cpu name to use for pfm counters, leave empty to autodetect"),
cl::cat(Options), cl::init(""));
static cl::opt<bool> AnalysisOverrideBenchmarksTripleAndCpu(
"analysis-override-benchmark-triple-and-cpu",
cl::desc("By default, we analyze the benchmarks for the triple/CPU they "
"were measured for, but if you want to analyze them for some "
"other combination (specified via -mtriple/-mcpu), you can "
"pass this flag."),
cl::cat(AnalysisOptions), cl::init(false));

static cl::opt<std::string>
TripleName("mtriple",
cl::desc("Target triple. See -version for available targets"),
cl::cat(Options));

static cl::opt<std::string>
MCPU("mcpu",
cl::desc("Target a specific cpu type (-mcpu=help for details)"),
cl::value_desc("cpu-name"), cl::cat(Options));

static cl::opt<bool>
DumpObjectToDisk("dump-object-to-disk",
Expand Down Expand Up @@ -291,28 +312,31 @@ generateSnippets(const LLVMState &State, unsigned Opcode,
}

void benchmarkMain() {
if (!BenchmarkSkipMeasurements) {
#ifndef HAVE_LIBPFM
ExitWithError("benchmarking unavailable, LLVM was built without libpfm.");
ExitWithError(
"benchmarking unavailable, LLVM was built without libpfm. You can pass "
"--skip-measurements to skip the actual benchmarking.");
#else
if (exegesis::pfm::pfmInitialize())
ExitWithError("cannot initialize libpfm");
#endif
}

if (exegesis::pfm::pfmInitialize())
ExitWithError("cannot initialize libpfm");

InitializeAllTargets();
InitializeAllTargetMCs();
InitializeAllAsmPrinters();
InitializeAllAsmParsers();
InitializeAllExegesisTargets();

const LLVMState State = ExitOnErr(LLVMState::Create("", CpuName));
const LLVMState State = ExitOnErr(LLVMState::Create(TripleName, MCPU));

// Preliminary check to ensure features needed for requested
// benchmark mode are present on target CPU and/or OS.
ExitOnErr(State.getExegesisTarget().checkFeatureSupport());
if (!BenchmarkSkipMeasurements)
ExitOnErr(State.getExegesisTarget().checkFeatureSupport());

const std::unique_ptr<BenchmarkRunner> Runner =
ExitOnErr(State.getExegesisTarget().createBenchmarkRunner(
BenchmarkMode, State, ResultAggMode));
BenchmarkMode, State, BenchmarkSkipMeasurements, ResultAggMode));
if (!Runner) {
ExitWithError("cannot create benchmark runner");
}
Expand Down Expand Up @@ -411,8 +435,6 @@ static void analysisMain() {
"and --analysis-inconsistencies-output-file must be specified");
}

InitializeAllTargets();
InitializeAllTargetMCs();
InitializeAllAsmPrinters();
InitializeAllDisassemblers();
InitializeAllExegesisTargets();
Expand All @@ -433,10 +455,12 @@ static void analysisMain() {
"is unsupported.");
}
auto TripleAndCpu = *TriplesAndCpus.begin();
if (!CpuName.empty()) {
if (AnalysisOverrideBenchmarksTripleAndCpu) {
llvm::errs() << "overridding file CPU name (" << TripleAndCpu.CpuName
<< ") with provided CPU name (" << CpuName << ")\n";
TripleAndCpu.CpuName = CpuName;
<< ") with provided tripled (" << TripleName
<< ") and CPU name (" << MCPU << ")\n";
TripleAndCpu.LLVMTriple = TripleName;
TripleAndCpu.CpuName = MCPU;
}
llvm::errs() << "using Triple '" << TripleAndCpu.LLVMTriple << "' and CPU '"
<< TripleAndCpu.CpuName << "'\n";
Expand Down Expand Up @@ -474,7 +498,24 @@ static void analysisMain() {

int main(int Argc, char **Argv) {
using namespace llvm;
cl::ParseCommandLineOptions(Argc, Argv, "");

InitLLVM X(Argc, Argv);

// Initialize targets so we can print them when flag --version is specified.
InitializeAllTargetInfos();
InitializeAllTargets();
InitializeAllTargetMCs();

// Enable printing of available targets when flag --version is specified.
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);

cl::HideUnrelatedOptions({&llvm::exegesis::Options,
&llvm::exegesis::BenchmarkOptions,
&llvm::exegesis::AnalysisOptions});

cl::ParseCommandLineOptions(Argc, Argv,
"llvm host machine instruction characteristics "
"measurment and analysis.\n");

exegesis::ExitOnErr.setExitCodeMapper([](const Error &Err) {
if (Err.isA<exegesis::ClusteringError>())
Expand Down