[llvm] r360008 - [SelectionDAG] Replace llvm_unreachable at the end of getCopyFromParts with a report_fatal_error.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun May 5 21:01:49 PDT 2019


Author: ctopper
Date: Sun May  5 21:01:49 2019
New Revision: 360008

URL: http://llvm.org/viewvc/llvm-project?rev=360008&view=rev
Log:
[SelectionDAG] Replace llvm_unreachable at the end of getCopyFromParts with a report_fatal_error.

Based on PR41748, not all cases are handled in this function.

llvm_unreachable is treated as an optimization hint than can prune code paths
in a release build. This causes weird behavior when PR41748 is encountered on a
release build. It appears to generate an fp_round instruction from the floating
point code.

Making this a report_fatal_error prevents incorrect optimization of the code
and will instead generate a message to file a bug report.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=360008&r1=360007&r2=360008&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sun May  5 21:01:49 2019
@@ -322,7 +322,7 @@ static SDValue getCopyFromParts(Selectio
     return DAG.getNode(ISD::FP_EXTEND, DL, ValueVT, Val);
   }
 
-  llvm_unreachable("Unknown mismatch!");
+  report_fatal_error("Unknown mismatch in getCopyFromParts!");
 }
 
 static void diagnosePossiblyInvalidConstraint(LLVMContext &Ctx, const Value *V,




More information about the llvm-commits mailing list