summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-12-09 23:04:59 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-12-09 23:04:59 +0000
commitd167eac023c6f96ecd8f92ca6965eca68e7b026d (patch)
tree0cb3bf4f6c1261598ccee622cbaeb43e92a49e4a /llvm/lib
parentf60e4410808a8e603aec272f16424a898f7b858a (diff)
downloadbcm5719-llvm-d167eac023c6f96ecd8f92ca6965eca68e7b026d.tar.gz
bcm5719-llvm-d167eac023c6f96ecd8f92ca6965eca68e7b026d.zip
IR: Metadata: Detect an RAUW recursion
Speculatively handle a recursion in `GenericMDNode::handleChangedOperand()`. I'm hoping this fixes the failing hexagon bot [1]. [1]: http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/13434 llvm-svn: 223849
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Metadata.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 805b7377bce..7a354c42c4c 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -495,6 +495,14 @@ void GenericMDNode::handleChangedOperand(void *Ref, Metadata *New) {
setOperand(Op, New);
return;
}
+ if (InRAUW) {
+ // We just hit a recursion due to RAUW. Set the operand and move on, since
+ // we're about to be deleted.
+ //
+ // FIXME: Can this cycle really happen?
+ setOperand(Op, New);
+ return;
+ }
auto &Store = getContext().pImpl->MDNodeSet;
Store.erase(this);
@@ -550,6 +558,7 @@ void GenericMDNode::handleChangedOperand(void *Ref, Metadata *New) {
// Collision.
if (!isResolved()) {
// Still unresolved, so RAUW.
+ InRAUW = true;
ReplaceableUses->replaceAllUsesWith(*I);
delete this;
return;
OpenPOWER on IntegriCloud