[all-commits] [llvm/llvm-project] 9e6aa8: [BPF] Fix a recursion bug in BPF Peephole ZEXT opt...
yonghong-song via All-commits
all-commits at lists.llvm.org
Fri Nov 22 08:08:17 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 9e6aa81588505461e06c807c567b073224f1e817
https://github.com/llvm/llvm-project/commit/9e6aa81588505461e06c807c567b073224f1e817
Author: Yonghong Song <yhs at fb.com>
Date: 2019-11-22 (Fri, 22 Nov 2019)
Changed paths:
M llvm/lib/Target/BPF/BPFMIPeephole.cpp
A llvm/test/CodeGen/BPF/32-bit-subreg-peephole-phi-3.ll
Log Message:
-----------
[BPF] Fix a recursion bug in BPF Peephole ZEXT optimization
Commit a0841dfe8594 ("[BPF] Fix a bug in peephole optimization")
fixed a bug in peephole optimization. Recursion is introduced
to handle COPY and PHI instructions.
Unfortunately, multiple PHI instructions may form a cycle
and this will cause infinite recursion, eventual segfault.
For Commit a0841dfe8594, I indeed tried a few loops to ensure
that I won't see the recursion, but I did not try with
complex control flows, which, as demonstrated with the test case
in this patch, may introduce PHI cycles.
This patch fixed the issue by introducing a set to remember
visited PHI instructions. This way, cycles can be properly
detected and handled.
Differential Revision: https://reviews.llvm.org/D70586
More information about the All-commits
mailing list