Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 917dcde

Browse files
authored
Merge pull request #76 from whitequark/constant-island-crash
Cherry-pick r295964 and closely related part of r282387
2 parents 15745af + 1c788d8 commit 917dcde

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

lib/Target/ARM/ARMConstantIslandPass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ initializeFunctionInfo(const std::vector<MachineInstr*> &CPEMIs) {
782782
case ARM::LDRcp:
783783
case ARM::t2LDRpci:
784784
case ARM::t2LDRHpci:
785+
case ARM::t2LDRBpci:
785786
Bits = 12; // +-offset_12
786787
NegOk = true;
787788
break;

test/CodeGen/ARM/constantpool-promote.ll

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
; RUN: llc -relocation-model=static < %s | FileCheck %s
2-
; RUN: llc -relocation-model=pic < %s | FileCheck %s
3-
; RUN: llc -relocation-model=ropi < %s | FileCheck %s
4-
; RUN: llc -relocation-model=rwpi < %s | FileCheck %s
5-
6-
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
7-
target triple = "armv7--linux-gnueabihf"
1+
; RUN: llc -mtriple armv7--linux-gnueabihf -relocation-model=static < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7ARM
2+
; RUN: llc -mtriple armv7--linux-gnueabihf -relocation-model=pic < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7ARM
3+
; RUN: llc -mtriple armv7--linux-gnueabihf -relocation-model=ropi < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7ARM
4+
; RUN: llc -mtriple armv7--linux-gnueabihf -relocation-model=rwpi < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7ARM
5+
; RUN: llc -mtriple thumbv7--linux-gnueabihf -relocation-model=static < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7THUMB
6+
; RUN: llc -mtriple thumbv7--linux-gnueabihf -relocation-model=pic < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7THUMB
7+
; RUN: llc -mtriple thumbv7--linux-gnueabihf -relocation-model=ropi < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7THUMB
8+
; RUN: llc -mtriple thumbv7--linux-gnueabihf -relocation-model=rwpi < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V7,CHECK-V7THUMB
9+
; RUN: llc -mtriple thumbv6m--linux-gnueabihf -relocation-model=static < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V6M
10+
; RUN: llc -mtriple thumbv6m--linux-gnueabihf -relocation-model=pic < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V6M
11+
; RUN: llc -mtriple thumbv6m--linux-gnueabihf -relocation-model=ropi < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V6M
12+
; RUN: llc -mtriple thumbv6m--linux-gnueabihf -relocation-model=rwpi < %s | FileCheck %s --check-prefixes=CHECK,CHECK-V6M
813

914
@.str = private unnamed_addr constant [2 x i8] c"s\00", align 1
1015
@.str1 = private unnamed_addr constant [69 x i8] c"this string is far too long to fit in a literal pool by far and away\00", align 1
@@ -135,6 +140,36 @@ define void @test9() #0 {
135140
ret void
136141
}
137142

143+
; CHECK-LABEL: @test10
144+
; CHECK-V6M: adr r{{[0-9]*}}, [[x:.*]]
145+
; CHECK-V6M: [[x]]:
146+
; CHECK-V6M: .asciz "s\000\000"
147+
; CHECK-V7: ldrb{{(.w)?}} r{{[0-9]*}}, [[x:.*]]
148+
; CHECK-V7: [[x]]:
149+
; CHECK-V7: .asciz "s\000\000"
150+
define void @test10(i8* %a) local_unnamed_addr #0 {
151+
call void @llvm.memmove.p0i8.p0i8.i32(i8* %a, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i32 1, i32 1, i1 false)
152+
ret void
153+
}
154+
155+
; CHECK-LABEL: @test11
156+
; CHECK-V6M: adr r{{[0-9]*}}, [[x:.*]]
157+
; CHECK-V6M: [[x]]:
158+
; CHECK-V6M: .short 3
159+
; CHECK-V6M: .short 4
160+
; CHECK-V7THUMB: ldrh{{(.w)?}} r{{[0-9]*}}, [[x:.*]]
161+
; CHECK-V7THUMB: [[x]]:
162+
; CHECK-V7THUMB: .short 3
163+
; CHECK-V7THUMB: .short 4
164+
; CHECK-V7ARM: adr r{{[0-9]*}}, [[x:.*]]
165+
; CHECK-V7ARM: [[x]]:
166+
; CHECK-V7ARM: .short 3
167+
; CHECK-V7ARM: .short 4
168+
define void @test11(i16* %a) local_unnamed_addr #0 {
169+
call void @llvm.memmove.p0i16.p0i16.i32(i16* %a, i16* getelementptr inbounds ([2 x i16], [2 x i16]* @.arr1, i32 0, i32 0), i32 2, i32 2, i1 false)
170+
ret void
171+
}
172+
138173
; Ensure that zero sized values are supported / not promoted.
139174
; CHECK-LABEL: @pr32130
140175
; CHECK-NOT: adr
@@ -146,14 +181,14 @@ define void @pr32130() #0 {
146181
declare void @b(i8*) #1
147182
declare void @c(i16*) #1
148183
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1)
184+
declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) local_unnamed_addr
185+
declare void @llvm.memmove.p0i16.p0i16.i32(i16*, i16*, i32, i32, i1) local_unnamed_addr
149186

150187
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
151188
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
152189
attributes #2 = { nounwind }
153190

154191
!llvm.module.flags = !{!0, !1}
155-
!llvm.ident = !{!2}
156192

157193
!0 = !{i32 1, !"wchar_size", i32 4}
158194
!1 = !{i32 1, !"min_enum_size", i32 4}
159-
!2 = !{!"Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)"}

0 commit comments

Comments
 (0)