diff options
author | Stephen Tozer <Stephen.Tozer@Sony.com> | 2021-03-17 15:04:27 +0000 |
---|---|---|
committer | Stephen Tozer <Stephen.Tozer@Sony.com> | 2021-03-17 16:45:25 +0000 |
commit | 3bfddc25931d44da9b26c092f4e15634712b1459 (patch) | |
tree | 1d46df6ec764c22fd1b16915b688ec105050ec42 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 410f09af09b9261f51663773bee01ec7b37e8fd4 (diff) | |
download | llvm-3bfddc25931d44da9b26c092f4e15634712b1459.zip llvm-3bfddc25931d44da9b26c092f4e15634712b1459.tar.gz llvm-3bfddc25931d44da9b26c092f4e15634712b1459.tar.bz2 |
Reapply "[DebugInfo] Handle multiple variable location operands in IR"
Fixed section of code that iterated through a SmallDenseMap and added
instructions in each iteration, causing non-deterministic code; replaced
SmallDenseMap with MapVector to prevent non-determinism.
This reverts commit 01ac6d1587e8613ba4278786e8341f8b492ac941.
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 9697e7d..d1a3ae5 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -407,7 +407,8 @@ static bool removeRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) { /// - Keep track of non-overlapping fragments. static bool removeRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { SmallVector<DbgValueInst *, 8> ToBeRemoved; - DenseMap<DebugVariable, std::pair<Value *, DIExpression *> > VariableMap; + DenseMap<DebugVariable, std::pair<SmallVector<Value *, 4>, DIExpression *>> + VariableMap; for (auto &I : *BB) { if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) { DebugVariable Key(DVI->getVariable(), @@ -416,10 +417,10 @@ static bool removeRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { auto VMI = VariableMap.find(Key); // Update the map if we found a new value/expression describing the // variable, or if the variable wasn't mapped already. - if (VMI == VariableMap.end() || - VMI->second.first != DVI->getValue() || + SmallVector<Value *, 4> Values(DVI->getValues()); + if (VMI == VariableMap.end() || VMI->second.first != Values || VMI->second.second != DVI->getExpression()) { - VariableMap[Key] = { DVI->getValue(), DVI->getExpression() }; + VariableMap[Key] = {Values, DVI->getExpression()}; continue; } // Found an identical mapping. Remember the instruction for later removal. |