[PATCH] D31906: [LV] Model if-converted phi node cost
Matthew Simpson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 11:51:48 PDT 2017
mssimpso added a comment.
Thanks, Michael!
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:7280
+ if (VF > 1 && Phi->getParent() != TheLoop->getHeader())
+ return (Phi->getNumIncomingValues() - 1) *
+ TTI.getCmpSelInstrCost(
----------------
mkuper wrote:
> We don't need to handle Phi->getNumIncomingValues() == 0 - it doesn't pass the verifier, right?
That's right.
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:7285
+
+ return TTI.getCFInstrCost(Instruction::PHI);
}
----------------
mkuper wrote:
> This returns 1 by default, right? I'm not entirely sure that's the right thing to do here, but it's probably no worse than the current state.
Yes, it returns 1. We went with getCFInstrCost(Instrunction::PHI) when doing the inserts for predicated instructions, so I thought it would be good to be consistent.
================
Comment at: test/Transforms/LoopVectorize/phi-cost.ll:7
+; CHECK-LABEL: phi_two_incoming_values
+; CHECK: LV: Found an estimated cost of 1 for VF 2 For instruction: %tmp5 = phi i32 [ %tmp1, %for.body ], [ %tmp4, %if.then ]
+; CHECK: vector.body:
----------------
mkuper wrote:
> Please also add a CHECK for the induction phi.
Will do.
https://reviews.llvm.org/D31906
More information about the llvm-commits
mailing list