Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 57aa5d9

Browse files
committed
Merging r339674:
------------------------------------------------------------------------ r339674 | aemerson | 2018-08-14 14:04:25 +0200 (Tue, 14 Aug 2018) | 3 lines [GlobalISel][IRTranslator] Fix a bug in handling repeating struct types during argument lowering. Differential Revision: https://reviews.llvm.org/D49442 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_70@340358 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent fbe3346 commit 57aa5d9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

include/llvm/CodeGen/GlobalISel/IRTranslator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ class IRTranslator : public MachineFunctionPass {
232232

233233
/// Returns true if the value should be split into multiple LLTs.
234234
/// If \p Offsets is given then the split type's offsets will be stored in it.
235+
/// If \p Offsets is not empty it will be cleared first.
235236
bool valueIsSplit(const Value &V,
236237
SmallVectorImpl<uint64_t> *Offsets = nullptr);
237238

lib/CodeGen/GlobalISel/IRTranslator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,8 @@ void IRTranslator::finishPendingPhis() {
14351435
bool IRTranslator::valueIsSplit(const Value &V,
14361436
SmallVectorImpl<uint64_t> *Offsets) {
14371437
SmallVector<LLT, 4> SplitTys;
1438+
if (Offsets && !Offsets->empty())
1439+
Offsets->clear();
14381440
computeValueLLTs(*DL, *V.getType(), SplitTys, Offsets);
14391441
return SplitTys.size() > 1;
14401442
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; RUN: llc -O0 -o - -verify-machineinstrs %s | FileCheck %s
2+
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
3+
target triple = "aarch64-unknown-linux-gnu"
4+
5+
; Check we don't crash due to encountering the same struct param type twice.
6+
; CHECK-LABEL: param_two_struct
7+
; CHECK: add
8+
; CHECK: ret
9+
define i64 @param_two_struct([2 x i64] %t.coerce, [2 x i64] %s.coerce) {
10+
entry:
11+
%t.coerce.fca.0.extract = extractvalue [2 x i64] %t.coerce, 0
12+
%s.coerce.fca.1.extract = extractvalue [2 x i64] %s.coerce, 1
13+
%add = add nsw i64 %s.coerce.fca.1.extract, %t.coerce.fca.0.extract
14+
ret i64 %add
15+
}

0 commit comments

Comments
 (0)