llvm.org GIT mirror llvm / 63bcfe3
Merging r331990: ------------------------------------------------------------------------ r331990 | whitequark | 2018-05-10 08:05:47 -0700 (Thu, 10 May 2018) | 15 lines [PR37339] Fix assertion in FunctionComparator::cmpInlineAsm Fixes bug https://bugs.llvm.org/show_bug.cgi?id=37339. InlineAsm is only uniqued if the FunctionTypes are exactly the same, while cmpTypes() for example considers all pointer types in the default address space to be the same. For this reason the end of cmpInlineAsm() can be reached. This patch replaces the unreachable assertion with a check that the function types are not identical. Differential Revision: https://reviews.llvm.org/D46495 Reviewers: jfb ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@332678 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 1 year, 3 months ago
2 changed file(s) with 54 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
709709 return Res;
710710 if (int Res = cmpNumbers(L->getDialect(), R->getDialect()))
711711 return Res;
712 llvm_unreachable("InlineAsm blocks were not uniqued.");
712 assert(L->getFunctionType() != R->getFunctionType());
713713 return 0;
714714 }
715715
0 ; RUN: opt -mergefunc -S < %s | FileCheck %s
1
2 ; CHECK-LABEL: @int_ptr_arg_different
3 ; CHECK-NEXT: call void asm
4
5 ; CHECK-LABEL: @int_ptr_arg_same
6 ; CHECK-NEXT: %2 = bitcast i32* %0 to float*
7 ; CHECK-NEXT: tail call void @float_ptr_arg_same(float* %2)
8
9 ; CHECK-LABEL: @int_ptr_null
10 ; CHECK-NEXT: tail call void @float_ptr_null()
11
12 ; Used to satisfy minimum size limit
13 declare void @stuff()
14
15 ; Can be merged
16 define void @float_ptr_null() {
17 call void asm "nop", "r"(float* null)
18 call void @stuff()
19 ret void
20 }
21
22 define void @int_ptr_null() {
23 call void asm "nop", "r"(i32* null)
24 call void @stuff()
25 ret void
26 }
27
28 ; Can be merged (uses same argument differing by pointer type)
29 define void @float_ptr_arg_same(float*) {
30 call void asm "nop", "r"(float* %0)
31 call void @stuff()
32 ret void
33 }
34
35 define void @int_ptr_arg_same(i32*) {
36 call void asm "nop", "r"(i32* %0)
37 call void @stuff()
38 ret void
39 }
40
41 ; Can not be merged (uses different arguments)
42 define void @float_ptr_arg_different(float*, float*) {
43 call void asm "nop", "r"(float* %0)
44 call void @stuff()
45 ret void
46 }
47
48 define void @int_ptr_arg_different(i32*, i32*) {
49 call void asm "nop", "r"(i32* %1)
50 call void @stuff()
51 ret void
52 }