From 4fbb93003b50762eb92e062bae0fe40b9c87a368 Mon Sep 17 00:00:00 2001 From: Michael Zolotukhin Date: Wed, 11 Apr 2018 23:37:37 +0000 Subject: [PATCH] [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 --- llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp b/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp index 9f358e1d60a3..854fda4aa830 100644 --- a/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp +++ b/llvm/lib/Transforms/Utils/SSAUpdaterBulk.cpp @@ -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); }