[PATCH] D26575: Fix for lost FastMathFlags in SLPVectorizer (intrinsic calls)

Vyacheslav Klochkov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 17:05:43 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287064: Fixed the lost FastMathFlags for CALL operations in SLPVectorizer. (authored by v_klochkov).

Changed prior to commit:
  https://reviews.llvm.org/D26575?vs=77711&id=78105#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26575

Files:
  llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
  llvm/trunk/test/Transforms/SLPVectorizer/X86/call.ll
  llvm/trunk/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll


Index: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2641,6 +2641,7 @@
         ExternalUses.push_back(ExternalUser(ScalarArg, cast<User>(V), 0));
 
       E->VectorizedValue = V;
+      propagateIRFlags(E->VectorizedValue, E->Scalars);
       ++NumVectorInstructions;
       return V;
     }
Index: llvm/trunk/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll
===================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/propagate_ir_flags.ll
@@ -398,5 +398,42 @@
   ret void
 }
 
-attributes #1 = { "target-features"="+avx" }
+declare double @llvm.fabs.f64(double) nounwind readnone
+
+;CHECK-LABEL: @call_fast(
+;CHECK: call fast <2 x double> @llvm.fabs.v2f64
+define void @call_fast(double* %x) {
+  %idx1 = getelementptr inbounds double, double* %x, i64 0
+  %idx2 = getelementptr inbounds double, double* %x, i64 1
+
+  %load1 = load double, double* %idx1, align 8
+  %load2 = load double, double* %idx2, align 8
+
+  %call1 = tail call fast double @llvm.fabs.f64(double %load1) nounwind readnone
+  %call2 = tail call fast double @llvm.fabs.f64(double %load2) nounwind readnone
+
+  store double %call1, double* %idx1, align 8
+  store double %call2, double* %idx2, align 8
+
+  ret void
+}
 
+;CHECK-LABEL: @call_no_fast(
+;CHECK: call <2 x double> @llvm.fabs.v2f64
+define void @call_no_fast(double* %x) {
+  %idx1 = getelementptr inbounds double, double* %x, i64 0
+  %idx2 = getelementptr inbounds double, double* %x, i64 1
+
+  %load1 = load double, double* %idx1, align 8
+  %load2 = load double, double* %idx2, align 8
+
+  %call1 = tail call fast double @llvm.fabs.f64(double %load1) nounwind readnone
+  %call2 = tail call double @llvm.fabs.f64(double %load2) nounwind readnone
+
+  store double %call1, double* %idx1, align 8
+  store double %call2, double* %idx2, align 8
+
+  ret void
+}
+
+attributes #1 = { "target-features"="+avx" }
Index: llvm/trunk/test/Transforms/SLPVectorizer/X86/call.ll
===================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/call.ll
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/call.ll
@@ -98,7 +98,7 @@
 
 
 ; CHECK: sqrt_libm
-; CHECK: call <2 x double> @llvm.sqrt.v2f64
+; CHECK: call nnan <2 x double> @llvm.sqrt.v2f64
 ; CHECK: ret void
 define void @sqrt_libm(double* %a, double* %b, double* %c) {
 entry:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26575.78105.patch
Type: text/x-patch
Size: 2652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161116/e2192e22/attachment.bin>


More information about the llvm-commits mailing list