[PATCH] D46495: Fix assertion in FunctionComparator::cmpInlineAsm
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 9 03:04:37 PDT 2018
nikic updated this revision to Diff 145888.
nikic added a comment.
Updated test to test both different pointer types as inline asm argument types and return types.
I've also adjusted the test to make the functions internal and have a separate function call them. This avoids the need for the somewhat non-obvious `call void @stuff` calls to satisfy minimum function size.
https://reviews.llvm.org/D46495
Files:
lib/Transforms/Utils/FunctionComparator.cpp
test/Transforms/MergeFunc/inline-asm.ll
Index: test/Transforms/MergeFunc/inline-asm.ll
===================================================================
--- /dev/null
+++ test/Transforms/MergeFunc/inline-asm.ll
@@ -0,0 +1,35 @@
+; RUN: opt -mergefunc -S < %s | FileCheck %s
+define internal void @float_ptr_arg() {
+ call void asm "nop", "r"(float* null)
+ ret void
+}
+
+define internal void @int_ptr_arg() {
+; CHECK-NOT: @int_ptr_arg()
+ call void asm "nop", "r"(i32* null)
+ ret void
+}
+
+define internal void @float_ptr_ret() {
+ call float* asm "nop", "=r"()
+ ret void
+}
+
+define internal void @int_ptr_ret() {
+; CHECK-NOT: @int_ptr_ret()
+ call i32* asm "nop", "=r"()
+ ret void
+}
+
+define void @do_calls() {
+; CHECK-LABEL: @do_calls
+; CHECK-NEXT call void @float_ptr_arg()
+; CHECK-NEXT call void @float_ptr_arg()
+; CHECK-NEXT call void @float_ptr_ret()
+; CHECK-NEXT call void @float_ptr_ret()
+ call void @float_ptr_arg()
+ call void @int_ptr_arg()
+ call void @float_ptr_ret()
+ call void @int_ptr_ret()
+ ret void
+}
Index: lib/Transforms/Utils/FunctionComparator.cpp
===================================================================
--- lib/Transforms/Utils/FunctionComparator.cpp
+++ lib/Transforms/Utils/FunctionComparator.cpp
@@ -710,7 +710,7 @@
return Res;
if (int Res = cmpNumbers(L->getDialect(), R->getDialect()))
return Res;
- llvm_unreachable("InlineAsm blocks were not uniqued.");
+ assert(L->getFunctionType() != R->getFunctionType());
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46495.145888.patch
Type: text/x-patch
Size: 1490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180509/65c6a799/attachment.bin>
More information about the llvm-commits
mailing list