[llvm] r174934 - Check type for legality before forming a select from loads.

Pete Cooper peter_cooper at apple.com
Mon Feb 11 19:14:50 PST 2013


Author: pete
Date: Mon Feb 11 21:14:50 2013
New Revision: 174934

URL: http://llvm.org/viewvc/llvm-project?rev=174934&view=rev
Log:
Check type for legality before forming a select from loads.

Sorry for the lack of a test case.  I tried writing one for i386 as i know selects are illegal on this target, but they are actually considered legal by isel and expanded later.

I can't see any targets to trigger this, but checking for the legality of a node before forming it is general goodness.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=174934&r1=174933&r2=174934&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Feb 11 21:14:50 2013
@@ -9400,7 +9400,9 @@ bool DAGCombiner::SimplifySelectOps(SDNo
         // src value info, don't do the transformation if the memory
         // locations are not in the default address space.
         LLD->getPointerInfo().getAddrSpace() != 0 ||
-        RLD->getPointerInfo().getAddrSpace() != 0)
+        RLD->getPointerInfo().getAddrSpace() != 0 ||
+        !TLI.isOperationLegalOrCustom(TheSelect->getOpcode(),
+                                      LLD->getBasePtr().getValueType()))
       return false;
 
     // Check that the select condition doesn't reach either load.  If so,





More information about the llvm-commits mailing list