[LLVMbugs] [Bug 16306] New: Loop Vectorizer strips address space id when generating a bitcast to/from a vector type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 12 06:54:45 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16306

            Bug ID: 16306
           Summary: Loop Vectorizer strips address space id when
                    generating a bitcast to/from a vector type
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: pekka.jaaskelainen at tut.fi
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat copy.c
char Y[4*10000] __attribute__((address_space(1)));
char X[4*10000];

int main() {
    for (int i = 0; i < 4*10000; ++i)
        X[i] = Y[i] + 1;
    return 0;
}

$ clang -O3 copy.c -S -emit-llvm -c -O3 -o  -
...
define i32 @main() #0 {
vector.ph:
  br label %vector.body

vector.body:                                      ; preds = %vector.body,
%vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %0 = getelementptr inbounds [40000 x i8] addrspace(1)* @Y, i64 0, i64 %index
  %1 = bitcast i8 addrspace(1)* %0 to <16 x i8>*
  %wide.load = load <16 x i8>* %1, align 16
  %.sum13 = or i64 %index, 16
  %2 = getelementptr [40000 x i8] addrspace(1)* @Y, i64 0, i64 %.sum13
  %3 = bitcast i8 addrspace(1)* %2 to <16 x i8>*
;                                     ^-------------- breaks here


  %wide.load10 = load <16 x i8>* %3, align 16
  %4 = add <16 x i8> %wide.load, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8
1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
  %5 = add <16 x i8> %wide.load10, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1,
i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
  %6 = getelementptr inbounds [40000 x i8]* @X, i64 0, i64 %index
  %7 = bitcast i8* %6 to <16 x i8>*
  store <16 x i8> %4, <16 x i8>* %7, align 16
  %.sum14 = or i64 %index, 16
  %8 = getelementptr [40000 x i8]* @X, i64 0, i64 %.sum14
  %9 = bitcast i8* %8 to <16 x i8>*
  store <16 x i8> %5, <16 x i8>* %9, align 16
  %index.next = add i64 %index, 32
  %10 = icmp eq i64 %index.next, 40000
  br i1 %10, label %for.end, label %vector.body

for.end:                                          ; preds = %vector.body
  ret i32 0
}
...

Is there a nice trick to disable loop vectorizer at the opt command line when
-O3 is used?

-- 
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/20130612/33993219/attachment.html>


More information about the llvm-bugs mailing list