[PATCH] D61124: Fix alignment in AArch64InstructionSelector::emitConstantPoolEntry()
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 03:09:36 PDT 2019
hans created this revision.
hans added reviewers: aemerson, t.p.northover.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar.
Herald added a project: LLVM.
The code was using the alignment of a pointer to the constant, not the
alignment of the constant itself.
I guess we got away with it so far because the pointer alignment is
fairly high, but we did end up under-aligning <16 x i8> vectors,
which was caught in the Chromium build (crbug.com/953815).
Please take a look.
+Amara who added the code in r354616, and Tim for general AArch64 goodness maybe in a closer timezone.
https://reviews.llvm.org/D61124
Files:
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-shuffle-vector.mir
Index: llvm/test/CodeGen/AArch64/GlobalISel/select-shuffle-vector.mir
===================================================================
--- llvm/test/CodeGen/AArch64/GlobalISel/select-shuffle-vector.mir
+++ llvm/test/CodeGen/AArch64/GlobalISel/select-shuffle-vector.mir
@@ -82,7 +82,7 @@
; CHECK-LABEL: name: shuffle_v4i32
; CHECK: constants:
; CHECK: value: '<16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 12, i8 13, i8 14, i8 15, i8 0, i8 1, i8 2, i8 3>'
- ; CHECK: alignment: 8
+ ; CHECK: alignment: 16
; CHECK: isTargetSpecific: false
; CHECK: liveins: $q0, $q1
; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
@@ -117,7 +117,7 @@
; CHECK-LABEL: name: shuffle_tbl_v4i32
; CHECK: constants:
; CHECK: value: '<16 x i8> <i8 20, i8 21, i8 22, i8 23, i8 28, i8 29, i8 30, i8 31, i8 4, i8 5, i8 6, i8 7, i8 0, i8 1, i8 2, i8 3>'
- ; CHECK: alignment: 8
+ ; CHECK: alignment: 16
; CHECK: isTargetSpecific: false
; CHECK: liveins: $q0, $q1
; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
@@ -153,7 +153,7 @@
; CHECK-LABEL: name: shuffle_v2i64
; CHECK: constants:
; CHECK: value: '<16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>'
- ; CHECK: alignment: 8
+ ; CHECK: alignment: 16
; CHECK: isTargetSpecific: false
; CHECK: liveins: $q0, $q1
; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
Index: llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
+++ llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
@@ -2572,7 +2572,7 @@
unsigned
AArch64InstructionSelector::emitConstantPoolEntry(Constant *CPVal,
MachineFunction &MF) const {
- Type *CPTy = CPVal->getType()->getPointerTo();
+ Type *CPTy = CPVal->getType();
unsigned Align = MF.getDataLayout().getPrefTypeAlignment(CPTy);
if (Align == 0)
Align = MF.getDataLayout().getTypeAllocSize(CPTy);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61124.196600.patch
Type: text/x-patch
Size: 2173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190425/1a1a1673/attachment.bin>
More information about the llvm-commits
mailing list