OSDN Git Service

[CodeGenPrepare] avoid crashing from replacing a phi twice
authorMikael Holmen <mikael.holmen@ericsson.com>
Fri, 15 Mar 2019 13:51:05 +0000 (13:51 +0000)
committerMikael Holmen <mikael.holmen@ericsson.com>
Fri, 15 Mar 2019 13:51:05 +0000 (13:51 +0000)
commitbc7dbf662a6574984e79e33331bbb1c80b4b5c7b
treee569d48d32fb62d8bdc0211e88c41e3b51a90514
parent7eaac1c18c01ab6178825864893cd9a7d1376fd5
[CodeGenPrepare]  avoid crashing from replacing a phi twice

Summary:
This is a fix to bug 41052:
https://bugs.llvm.org/show_bug.cgi?id=41052

While trying to optimize a memory instruction in a dead basic block, we end up registering the same phi for replacement twice. This patch avoids registering more than the first replacement candidate for a phi.

Patch by: JesperAntonsson

Reviewers: skatkov, aprantl

Reviewed By: aprantl

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356260 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenPrepare.cpp
test/CodeGen/X86/codegen-prepare-replacephi.mir [new file with mode: 0644]