forked from OSchip/llvm-project
Fix map insertion that is elided in release build.
The assert() macro doesn't actually execute its body in Release builds, so using it to check cache invariants requires that the insertion be outside of the assert() statement. This change does that, and also makes sure to return the actual map contents. llvm-svn: 284898
This commit is contained in:
parent
70a7738f84
commit
0db4549a1e
|
@ -558,10 +558,10 @@ namespace llvm {
|
|||
auto It = RewriteResults.find(S);
|
||||
if (It != RewriteResults.end())
|
||||
return It->second;
|
||||
auto *Result = SCEVVisitor<SC, const SCEV *>::visit(S);
|
||||
assert(RewriteResults.insert({S, Result}).second &&
|
||||
"Should insert a new entry");
|
||||
return Result;
|
||||
auto* Visited = SCEVVisitor<SC, const SCEV *>::visit(S);
|
||||
auto Result = RewriteResults.try_emplace(S, Visited);
|
||||
assert(Result.second && "Should insert a new entry");
|
||||
return Result.first->second;
|
||||
}
|
||||
|
||||
const SCEV *visitConstant(const SCEVConstant *Constant) {
|
||||
|
|
Loading…
Reference in New Issue