[PATCH] [BUG] "Rotate Loop" pass kills "llvm.vectorizer.enable" metadata

Alexander Musman alexander.musman at gmail.com
Fri Apr 11 09:40:33 PDT 2014


  What if the call to simplifyLoopLatch (at line 93 in lib/Transforms/Scalar/LoopRotation.cpp) removes metadata and subsequent rotateLoop at line 97 will not do anything, here is a small testcase for this. Is it possible to restore metadata here in the same way?


    ; RUN: opt < %s -O2 -force-vector-unroll=2 -force-vector-width=4 -debug-only=loop-vectorize -stats -S 2>&1 | FileCheck %s

    ; CHECK: LV: Loop hints: force=enabled

    target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
    target triple = "x86_64-unknown-linux-gnu"

    define i32 @foo(i32 %a) #0 {
    entry:
      br label %loop_cond

    loop_cond:                                        ; preds = %loop_inc, %entry
      %indx = phi i32 [ 1, %entry ], [ %inc, %loop_inc ]
      %cmp = icmp ne i32 %indx, %a
      br i1 %cmp, label %return, label %loop_inc

    loop_inc:                                         ; preds = %loop_cond
      %inc = add i32 %indx, 1
      br label %loop_cond, !llvm.loop !1

    return:                                           ; preds = %loop_cond
      ret i32 0
    }

    attributes #0 = { nounwind uwtable }

    !1 = metadata !{metadata !1, metadata !2}
    !2 = metadata !{metadata !"llvm.vectorizer.enable", i1 true}

http://reviews.llvm.org/D3348






More information about the llvm-commits mailing list