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

Commit b7234d1

Browse files
author
Sjoerd Meijer
committed
[ARM] f16 constant pool fix
This is a follow up of r325012, that allowed half types in constant pools. Proper alignment was enforced when a big basic block was split up, but not when a CPE was placed before/after a block; the successor block had the wrong alignment. Differential Revision: https://reviews.llvm.org/D43580 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325754 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 1763be4 commit b7234d1

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

lib/Target/ARM/ARMConstantIslandPass.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,10 +1425,6 @@ void ARMConstantIslands::createNewWater(unsigned CPUserIndex,
14251425
assert(!isThumb || getITInstrPredicate(*MI, PredReg) == ARMCC::AL));
14261426

14271427
NewMBB = splitBlockBeforeInstr(&*MI);
1428-
1429-
// 4 byte align the next block after the constant pool when the CPE is a
1430-
// 16-bit value in ARM mode, and 2 byte for Thumb.
1431-
NewMBB->setAlignment(isThumb ? 1 : 2);
14321428
}
14331429

14341430
/// handleConstantPoolUser - Analyze the specified user, checking to see if it
@@ -1489,6 +1485,8 @@ bool ARMConstantIslands::handleConstantPoolUser(unsigned CPUserIndex,
14891485
// We are adding new water. Update NewWaterList.
14901486
NewWaterList.insert(NewIsland);
14911487
}
1488+
// Always align the new block because CP entries can be smaller than 4 bytes.
1489+
NewMBB->setAlignment(isThumb ? 1 : 2);
14921490

14931491
// Remove the original WaterList entry; we want subsequent insertions in
14941492
// this vicinity to go after the one we're about to insert. This

test/CodeGen/ARM/constant-islands-cfg.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fixedStack:
3939
# CHECK: successors: %[[LONG_BR_BB:bb.[0-9]+]](0x{{[0-9a-f]+}}), %[[DEST1:bb.[0-9]+]](0x{{[0-9a-f]+}}){{$}}
4040
# CHECK: tBcc %[[LONG_BR_BB]], 0, $cpsr
4141
# CHECK: tB %[[DEST1]]
42-
# CHECK: [[LONG_BR_BB]]:
42+
# CHECK: [[LONG_BR_BB]] (align 1):
4343
# CHECK: successors: %[[DEST2:bb.[0-9]+]](0x{{[0-9a-f]+}}){{$}}
4444
# CHECK: tB %[[DEST2]]
4545
# CHECK: [[DEST1]]:
@@ -52,7 +52,7 @@ body: |
5252
tBcc %bb.2, 1, killed $cpsr
5353
tB %bb.3, 14, $noreg
5454
55-
bb.1:
55+
bb.1 (align 1):
5656
dead $r0 = SPACE 256, undef $r0
5757
5858
bb.2:

test/CodeGen/ARM/fp16-litpool-arm.mir

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# RUN: llc -mtriple=arm-none-eabi -run-pass=arm-cp-islands %s -o - | FileCheck %s
2-
2+
#
3+
# This checks alignment of a new block when a big basic block is split up.
4+
#
35
--- |
46
; ModuleID = '<stdin>'
57
source_filename = "<stdin>"

test/CodeGen/ARM/fp16-litpool-thumb.mir

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# RUN: llc -mtriple=thumbv7-none-eabi -run-pass=arm-cp-islands %s -o - | FileCheck %s
2+
#
3+
# This checks alignment of a new block when a big basic block is split up.
4+
#
25
--- |
36
; ModuleID = '<stdin>'
47
source_filename = "<stdin>"

0 commit comments

Comments
 (0)