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

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 11 16:37:37 PDT 2018


Author: mzolotukhin
Date: Wed Apr 11 16:37:37 2018
New Revision: 329864

URL: http://llvm.org/viewvc/llvm-project?rev=329864&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp?rev=329864&r1=329863&r2=329864&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SSAUpdaterBulk.cpp Wed Apr 11 16:37:37 2018
@@ -59,7 +59,8 @@ Value *SSAUpdaterBulk::computeValueAt(Ba
   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);
   }




More information about the llvm-commits mailing list