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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 16:40:40 PST 2016


arsenm 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);
----------------
resistor wrote:
> 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?
Probably. It seems like a mess to have all of these separate copies everywhere this is needed


Repository:
  rL LLVM

http://reviews.llvm.org/D17585





More information about the llvm-commits mailing list