[RISCV] Make computeIncomingVLVTYPE more conservative when merging predecessor state.
authorCraig Topper <craig.topper@sifive.com>
Mon, 19 Sep 2022 22:57:55 +0000 (15:57 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 19 Sep 2022 22:57:55 +0000 (15:57 -0700)
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

index ade89e8..187a1dc 100644 (file)
@@ -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();