forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IR] Fix ignoring
non-global-value-max-name-size
in `ValueSymbolTab…
…le::makeUniqueName()`. (llvm#89057) E.g. during inlining new symbol name can be duplicated and then `ValueSymbolTable::makeUniqueName()` will add unique suffix, exceeding the `non-global-value-max-name-size` restriction. Also fixed `unsigned` type of the option to `int` since `ValueSymbolTable`' constructor can use `-1` value that means unrestricted name size.
- Loading branch information
Showing
5 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; RUN: opt < %s -S -passes='always-inline' -non-global-value-max-name-size=5 | opt -non-global-value-max-name-size=5 -passes=verify -disable-output | ||
|
||
; Opt should not generate too long name for labels during inlining. | ||
|
||
define internal i32 @inner(i32 %flag) alwaysinline { | ||
entry: | ||
%icmp = icmp slt i32 %flag, 0 | ||
br i1 %icmp, label %one, label %two | ||
|
||
one: | ||
ret i32 42 | ||
|
||
two: | ||
ret i32 44 | ||
} | ||
|
||
define i32 @outer(i32 %x) { | ||
entry: | ||
%call1 = call i32 @inner(i32 %x) | ||
%call2 = call i32 @inner(i32 %x) | ||
%ret = add i32 %call1, %call2 | ||
ret i32 %ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
; REQUIRES: asserts | ||
; Force the size to be small to check assertion message. | ||
; RUN: not --crash opt -S %s -O2 -o - -non-global-value-max-name-size=0 2>&1 | FileCheck %s | ||
; CHECK: Can't generate unique name: MaxNameSize is too small. | ||
|
||
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters