From 93ea19b9a63f6c3f5d60d211b518051e2c714803 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Sun, 24 Jul 2016 07:03:49 +0000 Subject: [PATCH] [MSSA] Make EXPENSIVE_CHECKS check more. checkClobberSanity will now be run for all results of `ClobberWalk`, instead of just the crazy phi-optimized ones. This can help us catch cases where our cache is being wonky. llvm-svn: 276553 --- llvm/lib/Transforms/Utils/MemorySSA.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp index e304084..13ddd83 100644 --- a/llvm/lib/Transforms/Utils/MemorySSA.cpp +++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp @@ -236,9 +236,6 @@ checkClobberSanity(MemoryAccess *Start, MemoryAccess *ClobberAt, return; } - assert((isa(Start) || Start != ClobberAt) && - "Start can't clobber itself!"); - bool FoundClobber = false; DenseSet VisitedPhis; SmallVector Worklist; @@ -818,22 +815,23 @@ public: // Fast path for the overly-common case (no crazy phi optimization // necessary) UpwardsWalkResult WalkResult = walkToPhiOrClobber(FirstDesc); + MemoryAccess *Result; if (WalkResult.IsKnownClobber) { cacheDefPath(FirstDesc, WalkResult.Result); - return WalkResult.Result; + Result = WalkResult.Result; + } else { + OptznResult OptRes = tryOptimizePhi(cast(FirstDesc.Last), + Current, Q.StartingLoc); + verifyOptResult(OptRes); + cacheOptResult(OptRes); + resetPhiOptznState(); + Result = OptRes.PrimaryClobber.Clobber; } - OptznResult OptRes = - tryOptimizePhi(cast(FirstDesc.Last), Current, Q.StartingLoc); - verifyOptResult(OptRes); - cacheOptResult(OptRes); - resetPhiOptznState(); - #ifdef EXPENSIVE_CHECKS - checkClobberSanity(Current, OptRes.PrimaryClobber.Clobber, Q.StartingLoc, - MSSA, Q, AA); + checkClobberSanity(Current, Result, Q.StartingLoc, MSSA, Q, AA); #endif - return OptRes.PrimaryClobber.Clobber; + return Result; } }; -- 2.7.4