[llvm-bugs] [Bug 24944] New: Cast to typedef __attribute__((aligned(N))) pointer doesn't respect the requested alignment anymore.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 25 16:23:41 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24944

            Bug ID: 24944
           Summary: Cast to typedef __attribute__((aligned(N))) pointer
                    doesn't respect the requested alignment anymore.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ahmed.bougacha at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

typedef int __attribute__((ext_vector_type(4))) v4i32;
typedef v4i32 __attribute__((aligned(2))) v4i32_a2;

v4i32 l1(v4i32 *p) {
  v4i32_a2 *p2 = p;
  return *p2;
}

v4i32 l2(v4i32 *p) {
  return *(v4i32_a2*)p;
}


This used to generate:


define <4 x i32> @l1(<4 x i32>* nocapture readonly %p) #0 {
  %1 = load <4 x i32>* %p, align 2, !tbaa !2
  ret <4 x i32> %1
}

; Function Attrs: nounwind readonly ssp uwtable
define <4 x i32> @l2(<4 x i32>* nocapture readonly %p) #0 {
  %1 = load <4 x i32>* %p, align 2, !tbaa !2
  ret <4 x i32> %1
}


but now generates:


target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"

; Function Attrs: nounwind readonly ssp uwtable
define <4 x i32> @l1(<4 x i32>* nocapture readonly %p) #0 {
entry:
  %0 = load <4 x i32>, <4 x i32>* %p, align 2, !tbaa !2
  ret <4 x i32> %0
}

; Function Attrs: nounwind readonly ssp uwtable
define <4 x i32> @l2(<4 x i32>* nocapture readonly %p) #0 {
entry:
  %0 = load <4 x i32>, <4 x i32>* %p, align 16, !tbaa !2   ;; <- why not align
2?
  ret <4 x i32> %0
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150925/610798ab/attachment.html>


More information about the llvm-bugs mailing list