[PATCH] D113125: [LoopVectorize] Propagate fast-math flags for VPInstruction

Rosie Sumpter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 5 05:34:24 PDT 2021


RosieSumpter added a comment.

Thanks for the comments @dmgreen and @fhahn. RE printing the fast-math flags, it seems the only way is to check for each flag and print the correct word, as was being done in ##WriteOptimizationInfo## in llvm/lib/IR/AsmWriter.cpp. Since this is now occurring in two places, I've added a print method to FastMathFlags. Let me know if you think this is the right way to go.



================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:876
+  // Set the fast-math flags.
+  void setFastMathFlags(FastMathFlags FMFNew) { FMF = FMFNew; }
 };
----------------
fhahn wrote:
> can we assert that this is only used for opcodes that can take fast-math flags? On the IR side this is done by checking for `FPMathOperator`, but there's no helper to check if an opcode is a FP operation. Perhaps it would be sufficient to check for the relevant opcodes?
> 
> 
> Also, for now we only need to set fast-math flags at construction time I think, so could this be set directly in the constructor?
Hey @fhahn, thanks for this, I've added an assert to check for all the fp opcodes in ##setFastMathFlags##. I haven't set the fast-math flags directly in the constructor for now since the ##setFastMathFlags## approach makes the flag setting explicit, and mirrors the Instruction class. As always though, I'm happy to change it if you still think setting the flags in the constructor is the best way.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113125/new/

https://reviews.llvm.org/D113125



More information about the llvm-commits mailing list