[llvm] r212045 - [AArch64] Unsized types don't specify an alignment.
Chad Rosier
mcrosier at codeaurora.org
Mon Jun 30 08:03:00 PDT 2014
Author: mcrosier
Date: Mon Jun 30 10:03:00 2014
New Revision: 212045
URL: http://llvm.org/viewvc/llvm-project?rev=212045&view=rev
Log:
[AArch64] Unsized types don't specify an alignment.
PR20109
Added:
llvm/trunk/test/CodeGen/AArch64/funcptr_cast.ll
Modified:
llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp?rev=212045&r1=212044&r2=212045&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp Mon Jun 30 10:03:00 2014
@@ -593,8 +593,9 @@ bool AArch64DAGToDAGISel::SelectAddrMode
const GlobalValue *GV = GAN->getGlobal();
unsigned Alignment = GV->getAlignment();
const DataLayout *DL = TLI->getDataLayout();
- if (Alignment == 0 && !Subtarget->isTargetDarwin())
- Alignment = DL->getABITypeAlignment(GV->getType()->getElementType());
+ Type *Ty = GV->getType()->getElementType();
+ if (Alignment == 0 && Ty->isSized() && !Subtarget->isTargetDarwin())
+ Alignment = DL->getABITypeAlignment(Ty);
if (Alignment >= Size)
return true;
Added: llvm/trunk/test/CodeGen/AArch64/funcptr_cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/funcptr_cast.ll?rev=212045&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/funcptr_cast.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/funcptr_cast.ll Mon Jun 30 10:03:00 2014
@@ -0,0 +1,13 @@
+; RUN: llc < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
+
+define i8 @test() {
+; CHECK-LABEL: @test
+; CHECK: adrp {{x[0-9]+}}, foo
+; CHECK: add {{x[0-9]+}}, {{x[0-9]+}}, :lo12:foo
+; CHECK: ldrb w0, [{{x[0-9]+}}]
+entry:
+ %0 = load i8* bitcast (void (...)* @foo to i8*), align 1
+ ret i8 %0
+}
+
+declare void @foo(...)
More information about the llvm-commits
mailing list