[llvm] r256338 - [SCEV] Fix getLoopBackedgeTakenCounts
Bill Seurer via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 23 11:24:51 PST 2015
I agree it looks broken. Several of the buildbots are failing here:
/home/buildbots/ppc64be-llvm-quick/llvm-ppc64-2/llvm.src/lib/Analysis/ScalarEvolution.cpp:
In function ‘void getLoopBackedgeTakenCounts(llvm::Loop*, VerifyMap&,
llvm::ScalarEvolution&)’:
/home/buildbots/ppc64be-llvm-quick/llvm-ppc64-2/llvm.src/lib/Analysis/ScalarEvolution.cpp:9456:27:
error: use of ‘L’ before deduction of ‘auto’
for (auto *L : reverse(*L))
^
On 12/23/15 12:22, JF Bastien via llvm-commits wrote:
> Seems broken, I think r256338 fixes it.
>
> On Wed, Dec 23, 2015 at 9:48 AM, Sanjoy Das via llvm-commits
> <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>
> Author: sanjoy
> Date: Wed Dec 23 11:48:14 2015
> New Revision: 256338
>
> URL: http://llvm.org/viewvc/llvm-project?rev=256338&view=rev
> Log:
> [SCEV] Fix getLoopBackedgeTakenCounts
>
> The way `getLoopBackedgeTakenCounts` is written right now isn't
> correct. It will try to compute and store the BE counts of a Loop
> #{child loop} number of times (which may be zero).
>
> Modified:
> llvm/trunk/lib/Analysis/ScalarEvolution.cpp
>
> Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=256338&r1=256337&r2=256338&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Dec 23 11:48:14 2015
> @@ -9439,23 +9439,22 @@ static void replaceSubString(std::string
> /// getLoopBackedgeTakenCounts - Helper method for verifyAnalysis.
> static void
> getLoopBackedgeTakenCounts(Loop *L, VerifyMap &Map,
> ScalarEvolution &SE) {
> - for (Loop::reverse_iterator I = L->rbegin(), E = L->rend(); I !=
> E; ++I) {
> - getLoopBackedgeTakenCounts(*I, Map, SE); // recurse.
> + std::string &S = Map[L];
> + if (S.empty()) {
> + raw_string_ostream OS(S);
> + SE.getBackedgeTakenCount(L)->print(OS);
>
> - std::string &S = Map[L];
> - if (S.empty()) {
> - raw_string_ostream OS(S);
> - SE.getBackedgeTakenCount(L)->print(OS);
> -
> - // false and 0 are semantically equivalent. This can happen
> in dead loops.
> - replaceSubString(OS.str(), "false", "0");
> - // Remove wrap flags, their use in SCEV is highly fragile.
> - // FIXME: Remove this when SCEV gets smarter about them.
> - replaceSubString(OS.str(), "<nw>", "");
> - replaceSubString(OS.str(), "<nsw>", "");
> - replaceSubString(OS.str(), "<nuw>", "");
> - }
> + // false and 0 are semantically equivalent. This can happen in
> dead loops.
> + replaceSubString(OS.str(), "false", "0");
> + // Remove wrap flags, their use in SCEV is highly fragile.
> + // FIXME: Remove this when SCEV gets smarter about them.
> + replaceSubString(OS.str(), "<nw>", "");
> + replaceSubString(OS.str(), "<nsw>", "");
> + replaceSubString(OS.str(), "<nuw>", "");
> }
> +
> + for (auto *L : reverse(*L))
> + getLoopBackedgeTakenCounts(L, Map, SE); // recurse.
> }
>
> void ScalarEvolution::verify() const {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
-Bill Seurer
More information about the llvm-commits
mailing list