[PATCH] D41296: Limit size of non-GlobalValue name

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 07:43:36 PST 2018


serge-sans-paille added inline comments.


================
Comment at: test/Bitcode/value-with-long-name.ll:7
+
+; CHECK-NOT: %{{[a-z][a-z]+}}
+
----------------
hfinkel wrote:
> This test is a bit odd. Why not using two-character names and then check that they're not truncated when you get the max to 2 and they are truncated when you set the max to 1 (or zero).
I can add something like that

```
; RUN: opt -S %s -O2 -o - | FileCheck -check-prefix=CHECK-LONG %s

; Check we correctly cap the size of newly generated non-global values name
; Force the size to be small so that the check works on release and debug build
; RUN: opt -S %s -O2 -o - -non-global-value-max-name-size=0 | FileCheck -check-prefix=CHECK-SHORT %s
; RUN: opt -S %s -O2 -o - -non-global-value-max-name-size=1 | FileCheck -check-prefix=CHECK-SHORT %s

; CHECK-LONG: %{{[a-z]{4}[a-z]+}}
; CHECK-SHORT-NOT: %{{[a-z][a-z]+}}

define i32 @f(i32 %a, i32 %b) {
  %c = add i32 %a, %b
  %d = add i32 %c, %a
  %e = add i32 %d, %b
  ret i32 %e
}
```

But in that case in release build, when the name are stripped, the test will fail.


Repository:
  rL LLVM

https://reviews.llvm.org/D41296





More information about the llvm-commits mailing list