[llvm] 79b841d - Assembler: Replace some usage of grep in tests with FileCheck (#138114)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 1 04:45:23 PDT 2025


Author: Matt Arsenault
Date: 2025-05-01T13:45:20+02:00
New Revision: 79b841df750e6e3d4a0e817e59c5741da4b4ef6d

URL: https://github.com/llvm/llvm-project/commit/79b841df750e6e3d4a0e817e59c5741da4b4ef6d
DIFF: https://github.com/llvm/llvm-project/commit/79b841df750e6e3d4a0e817e59c5741da4b4ef6d.diff

LOG: Assembler: Replace some usage of grep in tests with FileCheck (#138114)

Added: 
    

Modified: 
    llvm/test/Assembler/2002-04-07-InfConstant.ll
    llvm/test/Assembler/2002-04-29-NameBinding.ll
    llvm/test/Assembler/2003-04-15-ConstantInitAssertion.ll
    llvm/test/Assembler/2003-05-12-MinIntProblem.ll
    llvm/test/Assembler/2003-05-21-MalformedStructCrash.ll
    llvm/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll
    llvm/test/Assembler/2003-11-24-SymbolTableCrash.ll
    llvm/test/Assembler/2004-01-20-MaxLongLong.ll
    llvm/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll
    llvm/test/Assembler/2006-09-28-CrashOnInvalid.ll
    llvm/test/Assembler/2006-12-09-Cast-To-Bool.ll
    llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll
    llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll
    llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll
    llvm/test/Assembler/2007-04-20-AlignedLoad.ll
    llvm/test/Assembler/2007-04-20-AlignedStore.ll
    llvm/test/Assembler/2007-08-06-AliasInvalid.ll
    llvm/test/Assembler/2008-01-11-VarargAttrs.ll
    llvm/test/Assembler/2008-02-18-IntPointerCrash.ll
    llvm/test/Assembler/2008-09-29-RetAttr.ll
    llvm/test/Assembler/2008-10-14-QuoteInName.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Assembler/2002-04-07-InfConstant.ll b/llvm/test/Assembler/2002-04-07-InfConstant.ll
index 6cd544791c574..d5cbfa755f39b 100644
--- a/llvm/test/Assembler/2002-04-07-InfConstant.ll
+++ b/llvm/test/Assembler/2002-04-07-InfConstant.ll
@@ -1,8 +1,9 @@
-; The output formater prints out 1.0e100 as Inf!
+; The output formatter prints out 1.0e100 as Inf!
 ;
-; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep 0x7FF0000000000000
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: fmul float 0x7FF0000000000000, 1.000000e+01
 define float @test() {
         %tmp = fmul float 0x7FF0000000000000, 1.000000e+01               ; <float> [#uses=1]
         ret float %tmp

diff  --git a/llvm/test/Assembler/2002-04-29-NameBinding.ll b/llvm/test/Assembler/2002-04-29-NameBinding.ll
index 20b28fb3086d7..681fe01445c5f 100644
--- a/llvm/test/Assembler/2002-04-29-NameBinding.ll
+++ b/llvm/test/Assembler/2002-04-29-NameBinding.ll
@@ -3,16 +3,18 @@
 ;
 ; Check by running globaldce, which will remove the constant if there are
 ; no references to it!
-; 
-; RUN: opt < %s -passes=globaldce -S | \
-; RUN:   not grep constant
+;
+; RUN: opt < %s -passes=globaldce -S | FileCheck %s
 ;
 ; RUN: verify-uselistorder %s
 
- at v1 = internal constant i32 5           
+; CHECK-NOT: constant
+; CHECK-NOT: @v1
+
+ at v1 = internal constant i32 5
 
 define i32 @createtask() {
-        %v1 = alloca i32                ;; Alloca should have one use! 
+        %v1 = alloca i32                ;; Alloca should have one use!
         %reg112 = load i32, ptr %v1         ;; This load should not use the global!
         ret i32 %reg112
 }

diff  --git a/llvm/test/Assembler/2003-04-15-ConstantInitAssertion.ll b/llvm/test/Assembler/2003-04-15-ConstantInitAssertion.ll
index 45e43b8a39639..9c9bdd8133f3d 100644
--- a/llvm/test/Assembler/2003-04-15-ConstantInitAssertion.ll
+++ b/llvm/test/Assembler/2003-04-15-ConstantInitAssertion.ll
@@ -1,5 +1,7 @@
-; RUN: not llvm-as < %s >/dev/null 2> %t
-; RUN: grep "struct initializer doesn't match struct element type" %t
+; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s
+
 ; Test the case of a misformed constant initializer
 ; This should cause an assembler error, not an assertion failure!
+
+; CHECK: struct initializer doesn't match struct element type
 @0 = constant { i32 } { float 1.0 }

diff  --git a/llvm/test/Assembler/2003-05-12-MinIntProblem.ll b/llvm/test/Assembler/2003-05-12-MinIntProblem.ll
index 1064a76fc94a9..a35178ebc27d9 100644
--- a/llvm/test/Assembler/2003-05-12-MinIntProblem.ll
+++ b/llvm/test/Assembler/2003-05-12-MinIntProblem.ll
@@ -1,6 +1,7 @@
-; RUN: llvm-as < %s | llvm-dis | grep -- -2147483648
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: i32 -2147483648
 define i32 @foo() {
         ret i32 -2147483648
 }

diff  --git a/llvm/test/Assembler/2003-05-21-MalformedStructCrash.ll b/llvm/test/Assembler/2003-05-21-MalformedStructCrash.ll
index b0c7e1a28b2ba..35fa2d552efec 100644
--- a/llvm/test/Assembler/2003-05-21-MalformedStructCrash.ll
+++ b/llvm/test/Assembler/2003-05-21-MalformedStructCrash.ll
@@ -1,5 +1,6 @@
 ; Found by inspection of the code
-; RUN: not llvm-as < %s  > /dev/null 2> %t
-; RUN: grep "initializer with struct type has wrong # elements" %t
+; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck %s
+
+; CHECK: initializer with struct type has wrong # elements
 
 @0 = global {} { i32 7, float 1.0, i32 7, i32 8 }

diff  --git a/llvm/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll b/llvm/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll
index 8fcf53ee5a8bc..9e78ae52b6dec 100644
--- a/llvm/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll
+++ b/llvm/test/Assembler/2003-08-20-ConstantExprGEP-Fold.ll
@@ -1,8 +1,13 @@
-; RUN: opt < %s -passes=instcombine,simplifycfg -S | not grep br
+; RUN: opt < %s -passes=instcombine,simplifycfg -S | FileCheck %s
 ; RUN: verify-uselistorder %s
 
 @.str_1 = internal constant [6 x i8] c"_Bool\00"                ; <ptr> [#uses=2]
 
+; Make sure there is no branch
+; CHECK: define i32 @test(
+; CHECK-NEXT: endif.7:
+; CHECK-NEXT: ret i32 0
+; CHECK-NEXT: }
 define i32 @test() {
         %tmp.54 = load i8, ptr getelementptr ([6 x i8], ptr @.str_1, i64 0, i64 1)            ; <i8> [#uses=1]
         %tmp.55 = icmp ne i8 %tmp.54, 66                ; <i1> [#uses=1]

diff  --git a/llvm/test/Assembler/2003-11-24-SymbolTableCrash.ll b/llvm/test/Assembler/2003-11-24-SymbolTableCrash.ll
index 28fd30178d6aa..e6a36edfb446c 100644
--- a/llvm/test/Assembler/2003-11-24-SymbolTableCrash.ll
+++ b/llvm/test/Assembler/2003-11-24-SymbolTableCrash.ll
@@ -1,5 +1,6 @@
-; RUN: not llvm-as < %s 2>&1 | grep "multiple definition"
+; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck %s
 
+; CHECK: error: multiple definition of local value named 'tmp.1'
 define void @test() {
 	%tmp.1 = add i32 0, 1
 	br label %return

diff  --git a/llvm/test/Assembler/2004-01-20-MaxLongLong.ll b/llvm/test/Assembler/2004-01-20-MaxLongLong.ll
index 42e477140da80..3d96fca64d8a5 100644
--- a/llvm/test/Assembler/2004-01-20-MaxLongLong.ll
+++ b/llvm/test/Assembler/2004-01-20-MaxLongLong.ll
@@ -1,5 +1,6 @@
-; RUN: llvm-as < %s | llvm-dis | grep 9223372036854775808
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: i64 -9223372036854775808
 @0 = global i64 -9223372036854775808
 

diff  --git a/llvm/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll b/llvm/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll
index 9f24f1afd55c2..2530dfbab1b4f 100644
--- a/llvm/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll
+++ b/llvm/test/Assembler/2004-03-30-UnclosedFunctionCrash.ll
@@ -1,3 +1,5 @@
-; RUN: not llvm-as %s 2>&1 | grep "found end of file when expecting more instructions"
+; RUN: not llvm-as %s 2>&1 | FileCheck %s
+
+; CHECK: found end of file when expecting more instructions
 
 define void @foo() {

diff  --git a/llvm/test/Assembler/2006-09-28-CrashOnInvalid.ll b/llvm/test/Assembler/2006-09-28-CrashOnInvalid.ll
index 6041bdf4797b9..e681fa759c894 100644
--- a/llvm/test/Assembler/2006-09-28-CrashOnInvalid.ll
+++ b/llvm/test/Assembler/2006-09-28-CrashOnInvalid.ll
@@ -1,7 +1,8 @@
 ; Test for PR902.  This program is erroneous, but should not crash llvm-as.
 ; This tests that a simple error is caught and processed correctly.
-; RUN: not llvm-as < %s >/dev/null 2> %t
-; RUN: grep "floating point constant invalid for type" %t
+; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s
+
+; CHECK: floating point constant invalid for type
 
 define void @test() {
   add i32 1, 2.0

diff  --git a/llvm/test/Assembler/2006-12-09-Cast-To-Bool.ll b/llvm/test/Assembler/2006-12-09-Cast-To-Bool.ll
index 91abe770a41cc..d18c374064ebc 100644
--- a/llvm/test/Assembler/2006-12-09-Cast-To-Bool.ll
+++ b/llvm/test/Assembler/2006-12-09-Cast-To-Bool.ll
@@ -1,6 +1,7 @@
-; RUN: llvm-as < %s | llvm-dis | grep bitcast
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: bitcast
 define i1 @main(i32 %X) {
   %res = bitcast i1 true to i1
   ret i1 %res

diff  --git a/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll b/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll
index 100466c438573..a8b99ad10c391 100644
--- a/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll
+++ b/llvm/test/Assembler/2007-01-16-CrashOnBadCast.ll
@@ -1,5 +1,7 @@
 ; PR1117
-; RUN: not llvm-as %s -o /dev/null 2>&1 | grep "invalid cast opcode for cast from"
+; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s
+
+; CHECK: error: invalid cast opcode for cast from 'i64' to 'ptr'
 
 define ptr @nada(i64 %X) {
     %result = trunc i64 %X to ptr

diff  --git a/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll b/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll
index 3e2919379de20..8faefe67035ef 100644
--- a/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll
+++ b/llvm/test/Assembler/2007-01-16-CrashOnBadCast2.ll
@@ -1,4 +1,5 @@
 ; PR1117
-; RUN: not llvm-as %s -o /dev/null 2>&1 | grep "invalid cast opcode for cast from"
+; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s
 
+; CHECK: error: invalid cast opcode for cast from 'i64' to 'ptr'
 @X = constant ptr trunc (i64 0 to ptr)

diff  --git a/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll b/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll
index 0f6b24d5d9f9c..084ae2454f454 100644
--- a/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll
+++ b/llvm/test/Assembler/2007-03-18-InvalidNumberedVar.ll
@@ -1,7 +1,7 @@
 ; PR 1258
-; RUN: not llvm-as < %s >/dev/null 2> %t
-; RUN: grep "'%0' defined with type 'i1'" %t
+; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck %s
 
+; CHECK: '%0' defined with type 'i1'
 define i32 @test1(i32 %a, i32 %b) {
 entry:
   icmp eq i32 %b, %a              ; <i1>:0 [#uses=1]

diff  --git a/llvm/test/Assembler/2007-04-20-AlignedLoad.ll b/llvm/test/Assembler/2007-04-20-AlignedLoad.ll
index 5709a22820322..89d7e3cf9d288 100644
--- a/llvm/test/Assembler/2007-04-20-AlignedLoad.ll
+++ b/llvm/test/Assembler/2007-04-20-AlignedLoad.ll
@@ -1,6 +1,7 @@
-; RUN: llvm-as < %s | llvm-dis | grep "align 1024"
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: %tmp2 = load i32, ptr %arg, align 1024
 define i32 @test(ptr %arg) {
 entry:
         %tmp2 = load i32, ptr %arg, align 1024      ; <i32> [#uses=1]

diff  --git a/llvm/test/Assembler/2007-04-20-AlignedStore.ll b/llvm/test/Assembler/2007-04-20-AlignedStore.ll
index 7571df3c28bda..89fa0445da977 100644
--- a/llvm/test/Assembler/2007-04-20-AlignedStore.ll
+++ b/llvm/test/Assembler/2007-04-20-AlignedStore.ll
@@ -1,6 +1,7 @@
-; RUN: llvm-as < %s | llvm-dis | grep "align 1024"
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: align 1024
 define void @test(ptr %arg) {
 entry:
         store i32 0, ptr %arg, align 1024

diff  --git a/llvm/test/Assembler/2007-08-06-AliasInvalid.ll b/llvm/test/Assembler/2007-08-06-AliasInvalid.ll
index 3abdc41cd3837..dd692c02b7426 100644
--- a/llvm/test/Assembler/2007-08-06-AliasInvalid.ll
+++ b/llvm/test/Assembler/2007-08-06-AliasInvalid.ll
@@ -1,10 +1,11 @@
-; RUN: not llvm-as < %s > /dev/null 2> %t
-; RUN: grep "expected top-level entity" %t
+; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck %s
 ; PR1577
 
- at anInt = global i32 1 
+; CHECK: expected top-level entity
+
+ at anInt = global i32 1
 alias i32 @anAlias
 
 define i32 @main() {
-   ret i32 0 
+   ret i32 0
 }

diff  --git a/llvm/test/Assembler/2008-01-11-VarargAttrs.ll b/llvm/test/Assembler/2008-01-11-VarargAttrs.ll
index 04993eb661d12..1283cc793ba38 100644
--- a/llvm/test/Assembler/2008-01-11-VarargAttrs.ll
+++ b/llvm/test/Assembler/2008-01-11-VarargAttrs.ll
@@ -1,10 +1,12 @@
-; RUN: llvm-as < %s | llvm-dis | grep byval
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
-	%struct = type {  }
+%struct = type {  }
 
+; CHECK: declare void @foo(...)
 declare void @foo(...)
 
+; CHECK: call void (...) @foo(ptr byval(%struct) null)
 define void @bar() {
 	call void (...) @foo(ptr byval(%struct) null )
 	ret void

diff  --git a/llvm/test/Assembler/2008-02-18-IntPointerCrash.ll b/llvm/test/Assembler/2008-02-18-IntPointerCrash.ll
index a5728a18f44d4..0d8fbc08917a0 100644
--- a/llvm/test/Assembler/2008-02-18-IntPointerCrash.ll
+++ b/llvm/test/Assembler/2008-02-18-IntPointerCrash.ll
@@ -1,6 +1,8 @@
-; RUN: not llvm-as %s 2>&1 | grep "integer constant must have integer type"
+; RUN: not llvm-as %s 2>&1 | FileCheck %s
 ; PR2060
 
+; CHECK: integer constant must have integer type
+
 define ptr @foo() {
        ret ptr 0
 }

diff  --git a/llvm/test/Assembler/2008-09-29-RetAttr.ll b/llvm/test/Assembler/2008-09-29-RetAttr.ll
index 5eb608d4a6931..bca9232a8aef6 100644
--- a/llvm/test/Assembler/2008-09-29-RetAttr.ll
+++ b/llvm/test/Assembler/2008-09-29-RetAttr.ll
@@ -1,12 +1,13 @@
 ; Test return attributes
-; RUN: llvm-as < %s | llvm-dis | grep "define inreg i32"
-; RUN: llvm-as < %s | llvm-dis | grep "call inreg i32"
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: define inreg i32 @fn1()
 define inreg i32 @fn1() {
   ret i32 0
 }
 
+; CHECK: call inreg i32 @fn1()
 define void @fn2() {
   %t = call inreg i32 @fn1()
   ret void

diff  --git a/llvm/test/Assembler/2008-10-14-QuoteInName.ll b/llvm/test/Assembler/2008-10-14-QuoteInName.ll
index aa95e79eef91c..6021290192f01 100644
--- a/llvm/test/Assembler/2008-10-14-QuoteInName.ll
+++ b/llvm/test/Assembler/2008-10-14-QuoteInName.ll
@@ -1,4 +1,5 @@
-; RUN: llvm-as < %s | llvm-dis | grep "quote"
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
 ; RUN: verify-uselistorder %s
 
+; CHECK: quote
 @"a\22quote" = global i32 0


        


More information about the llvm-commits mailing list