diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 30908c8ebf3..02029e6ae06 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2925,9 +2925,18 @@ bool LoopVectorizationLegality::canVectorizeInstrs() { // We still don't handle functions. However, we can ignore dbg intrinsic // calls and we do handle certain intrinsic and libm functions. CallInst *CI = dyn_cast(it); - if (CI && !getIntrinsicIDForCall(CI, TLI) && !isa(CI)) { + if (CI) { DEBUG(dbgs() << "LV: Found a call site.\n"); - return false; + + if (!isa(it)) { + DEBUG(dbgs() << "LV: We only vectorize intrinsics.\n"); + return false; + } + + if (!getIntrinsicIDForCall(CI, TLI) && !isa(CI)) { + DEBUG(dbgs() << "LV: Found an unknown intrinsic.\n"); + return false; + } } // Check that the instruction return type is vectorizable. diff --git a/test/Transforms/LoopVectorize/intrinsic.ll b/test/Transforms/LoopVectorize/intrinsic.ll index 216b937ad6d..99d6646e673 100644 --- a/test/Transforms/LoopVectorize/intrinsic.ll +++ b/test/Transforms/LoopVectorize/intrinsic.ll @@ -1018,7 +1018,7 @@ for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] %arrayidx = getelementptr inbounds float* %x, i64 %indvars.iv %0 = load float* %arrayidx, align 4 - %call = tail call float @fabsf(float %0) nounwind readnone + %call = tail call float @llvm.fabs.f32(float %0) nounwind readnone store float %call, float* %arrayidx, align 4 %indvars.iv.next = add i64 %indvars.iv, 1 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 @@ -1029,6 +1029,31 @@ for.end: ; preds = %for.body ret void } -declare float @fabsf(float) nounwind readnone - declare double @llvm.pow.f64(double, double) nounwind readnone + + +;CHECK: @not_intrin +;CHECK: @round +;CHECK-NOT: @round +;CHECK: ret +define void @not_intrin(i32* nocapture %A) nounwind ssp uwtable { + br label %1 + +;