[llvm] [SDAG] Merge multiple-result libcall expansion into DAG.expandMultipleResultFPLibCall() (PR #114792)
    Benjamin Maxwell via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Nov  4 12:15:12 PST 2024
    
    
  
================
@@ -270,6 +271,15 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
   DenseMap<SDValue, SDValue>::iterator I = LegalizedNodes.find(Op);
   if (I != LegalizedNodes.end()) return I->second;
 
+  // Handle legalizing the root if it changes.
+  auto FixupRoot = make_scope_exit([&, OldRoot = DAG.getRoot()] {
+    SDValue Root = DAG.getRoot();
+    if (Root != OldRoot) {
+      if (SDValue LegalRoot = LegalizeOp(Root))
+        DAG.setRoot(LegalRoot);
+    }
+  });
----------------
MacDue wrote:
I guess I could add an optional legalize callback to `DAG.expandMultipleResultFPLibCall()` :thinking: 
https://github.com/llvm/llvm-project/pull/114792
    
    
More information about the llvm-commits
mailing list