[llvm-branch-commits] [llvm-branch] r332263 - Merging r332176:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon May 14 10:17:14 PDT 2018

Author: tstellar
Date: Mon May 14 10:17:14 2018
New Revision: 332263

URL: http://llvm.org/viewvc/llvm-project?rev=332263&view=rev
Merging r332176:

r332176 | dim | 2018-05-12 12:59:54 -0700 (Sat, 12 May 2018) | 20 lines

Clear converters map after X86 Domain Reassignment to avoid crashes

As reported in PR37264, in some cases the X86 Domain Reassignment
`runOnMachineFunction()` is called twice.  Because it only deletes the
`.second` members of its `InstrConverterBaseMap`, and does not clean up
the map itself, this can lead to double frees and crashes.

Use `DeleteContainerSeconds()` instead, so the `Converters` map can
safely be reinitialized and its members re-deleted for each X86 Domain
Reassignment pass.

Reviewers: guyblank, craig.topper

Reviewed By: craig.topper

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D46425



Modified: llvm/branches/release_60/lib/Target/X86/X86DomainReassignment.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/lib/Target/X86/X86DomainReassignment.cpp?rev=332263&r1=332262&r2=332263&view=diff
--- llvm/branches/release_60/lib/Target/X86/X86DomainReassignment.cpp (original)
+++ llvm/branches/release_60/lib/Target/X86/X86DomainReassignment.cpp Mon May 14 10:17:14 2018
@@ -750,8 +750,7 @@ bool X86DomainReassignment::runOnMachine
       Changed = true;
-  for (auto I : Converters)
-    delete I.second;
+  DeleteContainerSeconds(Converters);
   DEBUG(dbgs() << "***** Machine Function after Domain Reassignment *****\n");

More information about the llvm-branch-commits mailing list