[PATCH] D34150: [LV] Test once if vector trip count is zero, instead of twice

Michael Kuperstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 06:14:52 PDT 2017


mkuper added a reviewer: wmi.
mkuper added a comment.

Re overflow - the point is that  getOrCreateTripCount() returns, basically, PSE.getBackedgeTakenCount() + 1, and that may overflow, so the "trip count" may end up being 0 if the backedge taken count is 0. I don't think this is outdated, and this is behavior we want to preserve. But this patch should preserve this behavior IIUC. Can you make sure there's a test for this?

Anyway, the logic seems sound, but I'd like wmi to look at it - he added the minimum iterations check in r245952, and combined it with the overflow check, instead of the VTC==0 check.
Wei, is there some case we're missing here?

One more thing about the description: "In this case a single (the last) vector iteration is peeled and replaced with VF*UF scalar iterations (instead of none), reducing VTC by 1." <-- this is confusing. That only happens if STC == 0 (mod VF * UF). So the logic is correct, since this is indeed what happens when STC == VF * UF, but I would phrase it differently.


https://reviews.llvm.org/D34150





More information about the llvm-commits mailing list