[PATCH] D108837: [SimplifyCFG] Ignore free instructions when computing cost for folding branch to common dest

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 15:22:25 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-logical.ll:142
   %cmp14 = fcmp olt double %conv13, 0.000000e+00
   br i1 %cmp14, label %if.then, label %lor.lhs.false16
 
----------------
aeubanks wrote:
> lebedev.ri wrote:
> > aeubanks wrote:
> > > Now this branch is getting folded into the next basic block. Then at the end of -O2 when every `fpext` is eliminated, the final simplifycfg will fold every branch (since each block only consists of at most one extra instruction besides the cmp and branch), except for this block which is now slightly bigger.
> > > Any ideas on how to fix this?
> > I do not understand why this test is being affected at all, there are no zero-cost instructions here?
> seems like we consider `%vecext17 = extractelement <4 x float> %t, i32 0` to be free
> 
> https://github.com/llvm/llvm-project/blob/063af63b9664151b3a9206feefa9a6a36a471e80/llvm/lib/Target/X86/X86TargetTransformInfo.cpp#L3433
> 
> I tried looking at the history, this special case seems very old
Ah, right, that makes sense.
Didn't look, but not sure there is a nice fix here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108837



More information about the llvm-commits mailing list