[PATCH] D52899: [SLPVectorizer] Check that lowered type is floating point before calling isFabsFree

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 11:56:07 PDT 2018


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin.

In the case of soft-fp (e.g. fp128 under wasm) the result of
getTypeLegalizationCost() can be an integer type even if the input is
floating point (See LegalizeTypeAction::TypeSoftenFloat).

Before calling isFabsFree() (which asserts if given a non-fp
type) we need to check that that result is fp.  This is safe since in
fabs is certainly not free in the soft-fp case.

Fixes PR39168


Repository:
  rL LLVM

https://reviews.llvm.org/D52899

Files:
  include/llvm/CodeGen/BasicTTIImpl.h


Index: include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- include/llvm/CodeGen/BasicTTIImpl.h
+++ include/llvm/CodeGen/BasicTTIImpl.h
@@ -1139,7 +1139,8 @@
     SmallVector<unsigned, 2> CustomCost;
     for (unsigned ISD : ISDs) {
       if (TLI->isOperationLegalOrPromote(ISD, LT.second)) {
-        if (IID == Intrinsic::fabs && TLI->isFAbsFree(LT.second)) {
+        if (IID == Intrinsic::fabs && LT.second.isFloatingPoint() &&
+            TLI->isFAbsFree(LT.second)) {
           return 0;
         }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52899.168342.patch
Type: text/x-patch
Size: 565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181004/ff0765c9/attachment.bin>


More information about the llvm-commits mailing list