[SSAUpdaterBulk] Fix linux bootstrap/sanitizer failures: explicitly specify order of evaluation.

The standard says that the order of evaluation of an expression
  s[x] = foo()
is unspecified. In our case, we first create an empty entry in the map,
then call foo(), then store its return value to the created entry. The
problem is that foo uses the map as a cache, so if it finds that there
is an entry in the map, it stops computation. This change explicitly
sets the order, thus fixing this heisenbug.

llvm-svn: 329864
This commit is contained in:
Michael Zolotukhin 2018-04-11 23:37:37 +00:00
parent cafa11289a
commit 4fbb93003b
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ Value *SSAUpdaterBulk::computeValueAt(BasicBlock *BB, RewriteInfo &R,
if (!R.Defines.count(BB)) {
if (DT->isReachableFromEntry(BB) && PredCache.get(BB).size()) {
BasicBlock *IDom = DT->getNode(BB)->getIDom()->getBlock();
R.Defines[BB] = computeValueAt(IDom, R, DT);
Value *V = computeValueAt(IDom, R, DT);
R.Defines[BB] = V;
} else
R.Defines[BB] = UndefValue::get(R.Ty);
}