This fixes PR531, a crash when running the CBE on a bytecode file.
authorChris Lattner <sabre@nondot.org>
Sun, 6 Mar 2005 02:14:28 +0000 (02:14 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 6 Mar 2005 02:14:28 +0000 (02:14 +0000)
commit04cb800c324ef661017aff474e266ed7f2cddb90
treeff69ae5b4e7e08abb9c04edd889b9ac9ddbf5a3b
parenteaadf5827692ae713faa6b38175559568c3dba26
This fixes PR531, a crash when running the CBE on a bytecode file.

The problem is that Function::renameLocalSymbols is iterating through
the symbol table planes, occasionally calling setName to rename a value
(which used to do a symbol table remove/insert pair).

The problem is that if there is only a single value in a particular type
plane that the remove will nuke the symbol table plane, and the insert
will create and insert a new one.  This hoses Function::renameLocalSymbols
because it has an iterator to the old plane, under the (very reasonable)
assumption that simply renaming a value won't cause the type plane to
disappear.

This patch fixes the bug by making the rename operation a single atomic
operation, which has a side effect of making the whole thing faster too. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20469 91177308-0d34-0410-b5e6-96231b3b80d8
lib/VMCore/SymbolTable.cpp
lib/VMCore/Value.cpp