[PATCH] [TOOL][TEST] A simple string replacing tool for testing purposes

Zinovy Nis zinovy.nis at gmail.com
Fri Sep 12 08:59:52 PDT 2014


Hi chapuni, ddunbar, hfinkel,

The **strreplace** tool helps to eliminate test code duplication. For example the sample иудщц checks 2 operations - add & sub - in the same test code, so you don't need to create 2 separate test files:


```
; RUN: strreplace '<OPER>' "add" < %s | strreplace "<OPER_ASM>" "addl" > %t.1
; RUN: llc -O0 < %t.1 -mtriple=i686-apple-darwin | FileCheck %t.1

; RUN: strreplace '<OPER>'  "sub" < %s | strreplace "<OPER_ASM>" "subl" > %t.2
; RUN: llc < %t.2 -mtriple=i686-apple-darwin | FileCheck %t.2

; CHECK-LABEL: @foo_<OPER>
; CHECK: <OPER_ASM>

define i32 @foo_<OPER>(i32 %v).
{
  %res = <OPER> i32 1234, %v
  ret i32 %res
}

```

http://reviews.llvm.org/D5331

Files:
  CMakeLists.txt
  test/CMakeLists.txt
  test/lit.cfg
  utils/Makefile
  utils/strreplace/CMakeLists.txt
  utils/strreplace/Makefile
  utils/strreplace/strreplace.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5331.13636.patch
Type: text/x-patch
Size: 3990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140912/4347861a/attachment.bin>


More information about the llvm-commits mailing list