2018-02-28 03:26:02 +08:00
|
|
|
# RUN: llc -mtriple=arm-none-eabi -run-pass=arm-cp-islands %s -o - | FileCheck %s
|
|
|
|
#
|
|
|
|
# This checks alignment of a block when a CPE is placed before/after a
|
|
|
|
# block (as e.g. opposed to splitting up a block), and also make sure
|
|
|
|
# we don't decrease alignment.
|
|
|
|
#
|
|
|
|
--- |
|
|
|
|
; ModuleID = '<stdin>'
|
|
|
|
source_filename = "<stdin>"
|
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
|
|
|
|
target triple = "arm-arm--eabi"
|
|
|
|
|
|
|
|
declare i32 @llvm.arm.space(i32, i32) #0
|
|
|
|
|
|
|
|
define dso_local i32 @CP() #1 {
|
|
|
|
entry:
|
|
|
|
%res = alloca half, align 2
|
|
|
|
store half 0xH706B, half* %res, align 2
|
|
|
|
%0 = load half, half* %res, align 2
|
|
|
|
%tobool = fcmp une half %0, 0xH0000
|
|
|
|
br i1 %tobool, label %LA, label %END
|
|
|
|
|
|
|
|
LA: ; preds = %entry
|
|
|
|
%1 = call i32 @llvm.arm.space(i32 1000, i32 undef)
|
|
|
|
br label %END
|
|
|
|
|
|
|
|
END: ; preds = %LA, %entry
|
|
|
|
%2 = call i32 @llvm.arm.space(i32 100, i32 undef)
|
|
|
|
ret i32 42
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
|
|
|
declare void @llvm.stackprotector(i8*, i8**) #2
|
|
|
|
|
|
|
|
attributes #0 = { nounwind "target-features"="+v8.2a,+fullfp16" }
|
|
|
|
attributes #1 = { "target-features"="+v8.2a,+fullfp16" }
|
|
|
|
attributes #2 = { nounwind }
|
|
|
|
|
|
|
|
...
|
|
|
|
---
|
|
|
|
name: CP
|
[Alignment] Use llvm::Align in MachineFunction and TargetLowering - fixes mir parsing
Summary:
This catches malformed mir files which specify alignment as log2 instead of pow2.
See https://reviews.llvm.org/D65945 for reference,
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: MatzeB, qcolombet, dschuff, arsenm, sdardis, nemanjai, jvesely, nhaehnle, hiraditya, kbarton, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67433
llvm-svn: 371608
2019-09-11 19:16:48 +08:00
|
|
|
alignment: 4
|
2018-02-28 03:26:02 +08:00
|
|
|
exposesReturnsTwice: false
|
|
|
|
legalized: false
|
|
|
|
regBankSelected: false
|
|
|
|
selected: false
|
|
|
|
tracksRegLiveness: true
|
|
|
|
registers:
|
|
|
|
liveins:
|
|
|
|
frameInfo:
|
|
|
|
isFrameAddressTaken: false
|
|
|
|
isReturnAddressTaken: false
|
|
|
|
hasStackMap: false
|
|
|
|
hasPatchPoint: false
|
|
|
|
stackSize: 4
|
|
|
|
offsetAdjustment: 0
|
|
|
|
maxAlignment: 2
|
|
|
|
adjustsStack: false
|
|
|
|
hasCalls: false
|
|
|
|
stackProtector: ''
|
|
|
|
maxCallFrameSize: 0
|
|
|
|
hasOpaqueSPAdjustment: false
|
|
|
|
hasVAStart: false
|
|
|
|
hasMustTailInVarArgFunc: false
|
|
|
|
savePoint: ''
|
|
|
|
restorePoint: ''
|
|
|
|
fixedStack:
|
|
|
|
stack:
|
|
|
|
- { id: 0, name: res, type: default, offset: -2, size: 2, alignment: 2,
|
2019-06-17 17:13:29 +08:00
|
|
|
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
|
2018-04-26 02:58:06 +08:00
|
|
|
local-offset: -2, debug-info-variable: '', debug-info-expression: '',
|
|
|
|
debug-info-location: '' }
|
2018-02-28 03:26:02 +08:00
|
|
|
constants:
|
|
|
|
- id: 0
|
|
|
|
value: half 0xH706B
|
|
|
|
alignment: 2
|
|
|
|
isTargetSpecific: false
|
|
|
|
|
|
|
|
|
[LLVM][Alignment] Make functions using log of alignment explicit
Summary:
This patch renames functions that takes or returns alignment as log2, this patch will help with the transition to llvm::Align.
The renaming makes it explicit that we deal with log(alignment) instead of a power of two alignment.
A few renames uncovered dubious assignments:
- `MirParser`/`MirPrinter` was expecting powers of two but `MachineFunction` and `MachineBasicBlock` were using deal with log2(align). This patch fixes it and updates the documentation.
- `MachineBlockPlacement` exposes two flags (`align-all-blocks` and `align-all-nofallthru-blocks`) supposedly interpreted as power of two alignments, internally these values are interpreted as log2(align). This patch updates the documentation,
- `MachineFunctionexposes` exposes `align-all-functions` also interpreted as power of two alignment, internally this value is interpreted as log2(align). This patch updates the documentation,
Reviewers: lattner, thegameg, courbet
Subscribers: dschuff, arsenm, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, hiraditya, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, Jim, s.egerton, llvm-commits, courbet
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65945
llvm-svn: 371045
2019-09-05 18:00:22 +08:00
|
|
|
#CHECK: bb.{{.*}} (align 2):
|
2018-02-28 03:26:02 +08:00
|
|
|
#CHECK: successors:
|
|
|
|
#CHECK: CONSTPOOL_ENTRY 1, %const{{.*}}, 2
|
|
|
|
#
|
|
|
|
# We don't want to decrease alignment if the block already has been
|
2019-01-31 07:09:28 +08:00
|
|
|
# aligned; this can e.g. be an existing CPE that has been carefully
|
|
|
|
# aligned. Here BB.1.LA has already an 8-byte alignment, and we are
|
2018-02-28 03:26:02 +08:00
|
|
|
# checking we don't set it to 4:
|
|
|
|
#
|
2019-01-31 07:09:28 +08:00
|
|
|
#CHECK: bb.{{.*}}.LA (align 8):
|
2018-02-28 03:26:02 +08:00
|
|
|
|
|
|
|
body: |
|
|
|
|
bb.0.entry:
|
|
|
|
successors: %bb.1(0x50000000), %bb.2(0x30000000)
|
|
|
|
|
|
|
|
$sp = frame-setup SUBri $sp, 4, 14, $noreg, $noreg
|
|
|
|
frame-setup CFI_INSTRUCTION def_cfa_offset 4
|
2021-05-20 10:25:51 +08:00
|
|
|
renamable $s0 = VLDRH %const.0, 0, 14, $noreg :: (load (s16) from constant-pool)
|
2018-02-28 03:26:02 +08:00
|
|
|
VCMPZH renamable $s0, 14, $noreg, implicit-def $fpscr_nzcv
|
2021-05-20 10:25:51 +08:00
|
|
|
VSTRH killed renamable $s0, $sp, 1, 14, $noreg :: (store (s16) into %ir.res)
|
2018-02-28 03:26:02 +08:00
|
|
|
FMSTAT 14, $noreg, implicit-def $cpsr, implicit killed $fpscr_nzcv
|
|
|
|
Bcc %bb.2, 0, killed $cpsr
|
|
|
|
|
2019-01-31 07:09:28 +08:00
|
|
|
bb.1.LA (align 8):
|
2018-02-28 03:26:02 +08:00
|
|
|
successors: %bb.2(0x80000000)
|
|
|
|
|
|
|
|
dead renamable $r0 = SPACE 1000, undef renamable $r0
|
|
|
|
|
|
|
|
bb.2.END:
|
|
|
|
dead renamable $r0 = SPACE 100, undef renamable $r0
|
|
|
|
$r0 = MOVi 42, 14, $noreg, $noreg
|
|
|
|
$sp = ADDri $sp, 4, 14, $noreg, $noreg
|
|
|
|
BX_RET 14, $noreg, implicit killed $r0
|
|
|
|
|
|
|
|
...
|