Skip to content

Commit fa2c36f

Browse files
committed
fixup! [SandboxVec] Early return checks
1 parent 0139985 commit fa2c36f

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bool SandboxVectorizerPass::runImpl(Function &F) {
3535
return false;
3636
}
3737
LLVM_DEBUG(dbgs() << "SBVec: Analyzing " << F.getName() << ".\n");
38-
// Don't vectorize when the attribute NoImplicitFloat is used.
38+
// Early return if the attribute NoImplicitFloat is used.
3939
if (F.hasFnAttribute(Attribute::NoImplicitFloat)) {
4040
LLVM_DEBUG(dbgs() << "SBVec: NoImplicitFloat attribute, return.\n");
4141
return false;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -passes=sandbox-vectorizer -mtriple=x86_64-- -mattr=+avx %s -S | FileCheck %s
3+
4+
; Check that we don't vectorize a NoImplicitFloat function.
5+
define void @no_implicit_float(ptr %ptr) noimplicitfloat {
6+
; CHECK-LABEL: define void @no_implicit_float(
7+
; CHECK-SAME: ptr [[PTR:%.*]]) #[[ATTR0:[0-9]+]] {
8+
; CHECK-NEXT: [[PTR0:%.*]] = getelementptr double, ptr [[PTR]], i32 0
9+
; CHECK-NEXT: [[PTR1:%.*]] = getelementptr double, ptr [[PTR]], i32 1
10+
; CHECK-NEXT: [[LD0:%.*]] = load double, ptr [[PTR0]], align 8
11+
; CHECK-NEXT: [[LD1:%.*]] = load double, ptr [[PTR1]], align 8
12+
; CHECK-NEXT: store double [[LD0]], ptr [[PTR0]], align 8
13+
; CHECK-NEXT: store double [[LD1]], ptr [[PTR1]], align 8
14+
; CHECK-NEXT: ret void
15+
;
16+
%ptr0 = getelementptr double, ptr %ptr, i32 0
17+
%ptr1 = getelementptr double, ptr %ptr, i32 1
18+
%ld0 = load double, ptr %ptr0
19+
%ld1 = load double, ptr %ptr1
20+
store double %ld0, ptr %ptr0
21+
store double %ld1, ptr %ptr1
22+
ret void
23+
}

llvm/test/Transforms/SandboxVectorizer/X86/no_vector_regs.ll

Lines changed: 0 additions & 9 deletions
This file was deleted.

llvm/test/Transforms/SandboxVectorizer/no_implicit_float.ll

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)