From a73feba9ee06f1c02c1c9b16328ee67a17cf135f Mon Sep 17 00:00:00 2001 From: Mike Danes Date: Sat, 25 Mar 2017 09:45:15 +0200 Subject: [PATCH] Correctly update bitvector in optAddVnAssertionMapping When short bitvectors are used only the first assertion was stored in the map stored bitvector, all subsequent assertions were stored into copies of that bitvector. Commit migrated from https://github.com/dotnet/coreclr/commit/fb604c571325fb1a2d4e2b0d5f98dce61f1f0475 --- src/coreclr/src/jit/assertionprop.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/coreclr/src/jit/assertionprop.cpp b/src/coreclr/src/jit/assertionprop.cpp index b804b96..87aa946 100644 --- a/src/coreclr/src/jit/assertionprop.cpp +++ b/src/coreclr/src/jit/assertionprop.cpp @@ -1483,13 +1483,15 @@ void Compiler::optPrintVnAssertionMapping() */ void Compiler::optAddVnAssertionMapping(ValueNum vn, AssertionIndex index) { - ASSERT_TP cur; - if (!optValueNumToAsserts->Lookup(vn, &cur)) + ASSERT_TP* cur = optValueNumToAsserts->LookupPointer(vn); + if (cur == nullptr) { - cur = BitVecOps::MakeEmpty(apTraits); - optValueNumToAsserts->Set(vn, cur); + optValueNumToAsserts->Set(vn, BitVecOps::MakeSingleton(apTraits, index - 1)); + } + else + { + BitVecOps::AddElemD(apTraits, *cur, index - 1); } - BitVecOps::AddElemD(apTraits, cur, index - 1); } /***************************************************************************** -- 2.7.4