[PATCH] D31175: Improve TargetTransformInfo::getCFInstrCost()

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 03:39:43 PDT 2017


jonpa added a comment.

> I'm fine with that as long as you add an appropriate comment. I don't want to hold up this patch for something that's not going make a difference.

Was this what you had in mind? Feel free to modify.

  ... 
     else
        // This branch will be eliminated by if-conversion.
        return 0;
      // Note: We currently assume zero cost for an unconditional branch inside
      // a predicated block since it will become a fall-through, although we
      // may decide in the future to call TTI for all branches.
    }

Perhaps more importantly, I see now that test/Transforms/LoopVectorize/AArch64/aarch64-predication.ll fails, because the loop does no longer get vectorized because

  < LV: Found an estimated cost of 0 for VF 2 For instruction:   br i1 %c, label %if.then, label %for.inc
  ---
  > LV: Found an estimated cost of 3 for VF 2 For instruction:   br i1 %c, label %if.then, label %for.inc



> (Hal) Okay, let's just make the assumption for now and worry about potential exceptions when we find some.

So, now it's the time to start worry about how to compute the cost for the branches around the predicated blocks -- what should be done about this test case? Is the cost of 3 making sense?


https://reviews.llvm.org/D31175





More information about the llvm-commits mailing list