Skip to content

Commit 9e73020

Browse files
committed
[ARM][ParallelDSP] Disable for big-endian
Bail early when we don't have a preheader and also if the target is big endian because it's written with only little endian in mind! Differential Revision: https://reviews.llvm.org/D59368 llvm-svn: 356243
1 parent 77eccf2 commit 9e73020

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

llvm/lib/Target/ARM/ARMParallelDSP.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ namespace {
201201
return false;
202202
}
203203

204+
// We need a preheader as getIncomingValueForBlock assumes there is one.
205+
if (!TheLoop->getLoopPreheader()) {
206+
LLVM_DEBUG(dbgs() << "No preheader found, bailing out\n");
207+
return false;
208+
}
209+
204210
Function &F = *Header->getParent();
205211
M = F.getParent();
206212
DL = &M->getDataLayout();
@@ -220,6 +226,12 @@ namespace {
220226
return false;
221227
}
222228

229+
if (!ST->isLittle()) {
230+
LLVM_DEBUG(dbgs() << "Only supporting little endian: not running pass "
231+
"ARMParallelDSP\n");
232+
return false;
233+
}
234+
223235
LoopAccessInfo LAI(L, SE, TLI, AA, DT, LI);
224236

225237
LLVM_DEBUG(dbgs() << "\n== Parallel DSP pass ==\n");
@@ -454,12 +466,6 @@ static void MatchReductions(Function &F, Loop *TheLoop, BasicBlock *Header,
454466
F.getFnAttribute("no-nans-fp-math").getValueAsString() == "true";
455467
const BasicBlock *Latch = TheLoop->getLoopLatch();
456468

457-
// We need a preheader as getIncomingValueForBlock assumes there is one.
458-
if (!TheLoop->getLoopPreheader()) {
459-
LLVM_DEBUG(dbgs() << "No preheader found, bailing out\n");
460-
return;
461-
}
462-
463469
for (PHINode &Phi : Header->phis()) {
464470
const auto *Ty = Phi.getType();
465471
if (!Ty->isIntegerTy(32) && !Ty->isIntegerTy(64))

llvm/test/CodeGen/ARM/ParallelDSP/multi-use-loads.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
; RUN: llc -O3 -mtriple=arm-arm-eabi -mcpu=cortex-m33 < %s | FileCheck %s
2+
; RUN: llc -O3 -mtriple=armeb-arm-eabi -mcpu=cortex-m33 < %s | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
3+
4+
; CHECK-UNSUPPORTED-NOT: smlad
25

36
; CHECK-LABEL: add_user
47
; CHECK: %for.body

llvm/test/CodeGen/ARM/ParallelDSP/smlad0.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m33 < %s -arm-parallel-dsp -S | FileCheck %s
2+
; RUN: opt -mtriple=armeb-arm-eabi -mcpu=cortex-m0 < %s -arm-parallel-dsp -S | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
23
;
34
; The Cortex-M0 does not support unaligned accesses:
45
; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m0 < %s -arm-parallel-dsp -S | FileCheck %s --check-prefix=CHECK-UNSUPPORTED

llvm/test/CodeGen/ARM/ParallelDSP/smladx-1.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; RUN: opt -mtriple=thumbv8m.main -mcpu=cortex-m33 -arm-parallel-dsp %s -S -o - | FileCheck %s
22
; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m0 < %s -arm-parallel-dsp -S | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
33
; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m33 -mattr=-dsp < %s -arm-parallel-dsp -S | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
4+
; RUN: opt -mtriple=armeb-arm-eabi -mcpu=cortex-m33 < %s -arm-parallel-dsp -S | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
45

56
define i32 @smladx(i16* nocapture readonly %pIn1, i16* nocapture readonly %pIn2, i32 %j, i32 %limit) {
67

llvm/test/CodeGen/ARM/ParallelDSP/smlald0.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m33 < %s -arm-parallel-dsp -S | FileCheck %s
2+
; RUN: opt -mtriple=armeb-arm-eabi -mcpu=cortex-m33 < %s -arm-parallel-dsp -S | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
23
;
34
; The Cortex-M0 does not support unaligned accesses:
45
; RUN: opt -mtriple=arm-arm-eabi -mcpu=cortex-m0 < %s -arm-parallel-dsp -S | FileCheck %s --check-prefix=CHECK-UNSUPPORTED

llvm/test/CodeGen/ARM/ParallelDSP/unroll-n-jam-smlad.ll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
; RUN: llc -O3 -mtriple=thumbv7em %s -o - | FileCheck %s
2+
; RUN: llc -O3 -mtriple=thumbv7eb %s -o - | FileCheck %s --check-prefix=CHECK-UNSUPPORTED
23
; RUN: llc -O3 -mtriple=thumbv8m.main -mattr=+dsp %s -o - | FileCheck %s
34

5+
; CHECK-UNSUPPORTED-LABEL: unroll_n_jam_smlad
6+
; CHECK-UNSUPPORTED-NOT: smlad r{{.}}
7+
48
; Test that the duplicate loads are removed, which allows parallel dsp to find
59
; the parallel operations.
610

11+
; CHECK-LABEL: unroll_n_jam_smlad
712
define void @unroll_n_jam_smlad(i32* %res, i16* %A, i16* %B, i32 %N, i32 %idx) {
813
entry:
914
%xtraiter306.i = and i32 %N, 3

0 commit comments

Comments
 (0)