From: Craig Topper Date: Mon, 19 Sep 2022 22:57:55 +0000 (-0700) Subject: [RISCV] Make computeIncomingVLVTYPE more conservative when merging predecessor state. X-Git-Tag: upstream/17.0.6~33089 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94049db913af32c5dfd8a09d0ba100f070363bdf;p=platform%2Fupstream%2Fllvm.git [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 --- 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();