[PATCH] D36244: [LoopVectorize] Fix assertion failure in Fcmp vectorization

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 23:37:31 PDT 2017


Ayal added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4867
+        IRBuilder<>::FastMathFlagGuard FMFG(Builder);
+        Builder.setFastMathFlags(Cmp->getFastMathFlags());
         C = Builder.CreateFCmp(Cmp->getPredicate(), A, B);
----------------
An alternative may be to do

```
  if (isa<FCmpInst>(C))
    cast<FCmpInst>(C)->copyFastMathFlags(Cmp);
```
or

```
  if (auto *FCmp = dyn_cast<FCmpInst>(C))
    FCmp->copyFastMathFlags(Cmp);
```


Wonder if the last, optional argument to CreateFCmp() may be used instead?

Is this issue relevant elsewhere, e.g., SLP vectorizer? (Maybe that last argument shouldn't be optional ;-)


https://reviews.llvm.org/D36244





More information about the llvm-commits mailing list