OSDN Git Service

[PowerPC] Fix infinite loop in peephole CR optimization (PR49509)
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Mar 2021 13:37:09 +0000 (14:37 +0100)
committerTom Stellard <tstellar@redhat.com>
Mon, 29 Mar 2021 23:43:55 +0000 (16:43 -0700)
commit8ca56905dd9bdade269b5bc91528495884b62bf5
tree80024e9366e0497419ce4f84df555a85975adbd7
parentf43958b7c497c526b238607624ee0069888f4c98
[PowerPC] Fix infinite loop in peephole CR optimization (PR49509)

If we encounter a degenerate select node where both operands are
the same, then we can continue negating the condition while swapping
operands, resulting in an infinite loop. Avoid this by bailing out
if both operands are the same.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49509.

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

(cherry picked from commit 2489cbaa8057c736475fd88990f4f6dbf022873d)
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
llvm/test/CodeGen/PowerPC/pr49509.ll [new file with mode: 0644]