[PATCH] D16156: Proper handling of diamond-like cases in if-conversion

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 11:58:46 PST 2016


MatzeB added a comment.

I am not too familiar with the if conversion code, but reading it so far it looks to me like ValidDiamond is not supposed to handle case where there is not common join block. I would expect a branch ending in return to hit the ValidSimple() case.

My understanding if the code is that return instructions are not analyzable and the code sequence at the beginning of ValidDiamond() should reject cases where both blocks do not end in analyzable branches (the 4th if should reject them I think).

  if (!TT && blockAlwaysFallThrough(TrueBBI))
    TT = getNextBlock(TrueBBI.BB);
  if (!FT && blockAlwaysFallThrough(FalseBBI))
    FT = getNextBlock(FalseBBI.BB);
  if (TT != FT)
    return false;
  if (!TT && (TrueBBI.IsBrAnalyzable || FalseBBI.IsBrAnalyzable))
    return false;
  if  (TrueBBI.BB->pred_size() > 1 || FalseBBI.BB->pred_size() > 1)
    return false;

Can you reproduce the issue with other backends? I am not convinced yet that the problem is not AnalyzeBranch() reporting unexpected values.


Repository:
  rL LLVM

http://reviews.llvm.org/D16156





More information about the llvm-commits mailing list