diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-08 12:13:52 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-11 20:09:54 +0100 |
| commit | b361d3bbcd85647c9f6640a5f57932c43fdb7a1a (patch) | |
| tree | 6bc9851a928fe20c9540c3988735690483f154ff /llvm/test/Transforms/MergeFunc | |
| parent | 25e21a09b3f6e9ce747555e61e7d1fbaa161056f (diff) | |
| download | bcm5719-llvm-b361d3bbcd85647c9f6640a5f57932c43fdb7a1a.tar.gz bcm5719-llvm-b361d3bbcd85647c9f6640a5f57932c43fdb7a1a.zip | |
[MergeFuncs] Remove incorrect attribute copying
Fix for https://bugs.llvm.org/show_bug.cgi?id=44236. This code was
originally introduced in rG36512330041201e10f5429361bbd79b1afac1ea1.
However, the attribute copying was done in the wrong place (in general
call replacement, not thunk generation) and a proper fix was
implemented in D12581.
Previously this code was just unnecessary but harmless (because
FunctionComparator ensured that the attributes of the two functions
are exactly the same), but since byval was changed to accept a type
this copying is actively wrong and may result in malformed IR.
Differential Revision: https://reviews.llvm.org/D71173
Diffstat (limited to 'llvm/test/Transforms/MergeFunc')
| -rw-r--r-- | llvm/test/Transforms/MergeFunc/byval-attr-congruent-type.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Transforms/MergeFunc/byval-attr-congruent-type.ll b/llvm/test/Transforms/MergeFunc/byval-attr-congruent-type.ll new file mode 100644 index 00000000000..7e7d772b977 --- /dev/null +++ b/llvm/test/Transforms/MergeFunc/byval-attr-congruent-type.ll @@ -0,0 +1,30 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -mergefunc %s | FileCheck %s + +%struct.c = type { i32 } +%struct.a = type { i32 } + +@d = external dso_local global %struct.c + +define void @e(%struct.a* byval(%struct.a) %f) { +; CHECK-LABEL: @e( +; CHECK-NEXT: ret void +; + ret void +} + +define void @g(%struct.c* byval(%struct.c) %f) { +; CHECK-LABEL: @g( +; CHECK-NEXT: ret void +; + ret void +} + +define void @h() { +; CHECK-LABEL: @h( +; CHECK-NEXT: call void bitcast (void (%struct.a*)* @e to void (%struct.c*)*)(%struct.c* byval(%struct.c) @d) +; CHECK-NEXT: ret void +; + call void @g(%struct.c* byval(%struct.c) @d) + ret void +} |

