From 94049db913af32c5dfd8a09d0ba100f070363bdf Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 19 Sep 2022 15:57:55 -0700 Subject: [PATCH] [RISCV] Make computeIncomingVLVTYPE more conservative when merging predecessor state. If we have already calculated the incoming state before, use that as our starting point to ensure we are conservative. This fixes an infinite loop found in our downstream where we we allowed two waves of updates to propagate through a loop and the merge points allowed us to toggle back and forth between states. No small reproducer right now. Differential Revision: https://reviews.llvm.org/D134229 --- llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index ade89e8..187a1dc 100644 --- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp +++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp @@ -1088,7 +1088,9 @@ void RISCVInsertVSETVLI::computeIncomingVLVTYPE(const MachineBasicBlock &MBB) { BBInfo.InQueue = false; - VSETVLIInfo InInfo; + // Start with the previous entry so that we keep the most conservative state + // we have ever found. + VSETVLIInfo InInfo = BBInfo.Pred; if (MBB.pred_empty()) { // There are no predecessors, so use the default starting status. InInfo.setUnknown(); -- 2.7.4