[PATCH] D7299: Prevent hoisting fmul from THEN/ELSE to IF if there is fmsub/fmadd opportunity

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 08:55:10 PDT 2016


sebpop added a subscriber: sebpop.
sebpop added a comment.

IMO this patch should not have been committed.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:6540
@@ +6539,3 @@
+/// Not profitable if I and it's user can form a FMA instruction
+/// because we prefer FMSUB/FMADD.
+bool AArch64TargetLowering::isProfitableToHoist(Instruction *I) const {
----------------
I think that this is only avoiding a bigger issue, that is currently the instruction selection happens on a single basic block.
A better fix would be a machine pass that pairs multiplies with add/sub to form more FMAs.



================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:6561
@@ +6560,3 @@
+      (Options.AllowFPOpFusion == FPOpFusion::Fast || Options.UnsafeFPMath))
+    return false;
+
----------------
If both the multiply and the add/sub it feeds into can be hoisted, this code will still prevent multiplies to be hoisted.


Repository:
  rL LLVM

http://reviews.llvm.org/D7299





More information about the llvm-commits mailing list