[PATCH] D17585: Fix failure of InstCombine to propagate fast math flags when scalarizing vector arithmetic.

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 11:05:03 PST 2016


resistor added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineVectorOps.cpp:108-110
@@ -107,4 +107,5 @@
           *B0);
-      Value *newPHIUser = InsertNewInstWith(
-          BinaryOperator::Create(B0->getOpcode(), scalarPHI, Op), *B0);
+      BinaryOperator *newPHIUser = cast<BinaryOperator>(InsertNewInstWith(
+          BinaryOperator::Create(B0->getOpcode(), scalarPHI, Op), *B0));
+      newPHIUser->copyIRFlags(B0);
       scalarPHI->addIncoming(newPHIUser, inBB);
----------------
arsenm wrote:
> Should a BinaryOperator::CreateWithFlags be added? It already has CreateNSW etc.
It would have to be something like BinaryOperator::CreateWithCopiedFlags, because there's not simple "give me all the flags" methods exposed on BinaryOperator.  Seems a little awkward, but maybe it's still better?


Repository:
  rL LLVM

http://reviews.llvm.org/D17585





More information about the llvm-commits mailing list