[llvm] r340626 - [DAGCombiner][Mips] Don't combine bitcast+store after LegalOperations when the store is volatile, if the resulting store isn't Legal

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 10:48:25 PDT 2018


Author: ctopper
Date: Fri Aug 24 10:48:25 2018
New Revision: 340626

URL: http://llvm.org/viewvc/llvm-project?rev=340626&view=rev
Log:
[DAGCombiner][Mips] Don't combine bitcast+store after LegalOperations when the store is volatile, if the resulting store isn't Legal

Previously we allowed the store to be Custom. But without knowing for sure that the Custom handling won't split the store, we shouldn't convert a volatile store. We also probably shouldn't be creating a store the requires custom handling after LegalizeOps. This could lead to an infinite loop if the custom handling was to insert a bitcast. Though I guess isStoreBitCastBeneficial could be used to block such a loop.

The test changes here are due to the volatile part of this. The stores in the test are all volatile and i32 stores are marked custom, So we are no longer converting them

This is related to D50491 where I was trying to allow some bitcasting of volatile loads

Differential Revision: https://reviews.llvm.org/D50578

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float-varargs.ll
    llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=340626&r1=340625&r2=340626&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Aug 24 10:48:25 2018
@@ -14684,7 +14684,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *
       ST->isUnindexed()) {
     EVT SVT = Value.getOperand(0).getValueType();
     if (((!LegalOperations && !ST->isVolatile()) ||
-         TLI.isOperationLegalOrCustom(ISD::STORE, SVT)) &&
+         TLI.isOperationLegal(ISD::STORE, SVT)) &&
         TLI.isStoreBitCastBeneficial(Value.getValueType(), SVT)) {
       unsigned OrigAlign = ST->getAlignment();
       bool Fast = false;

Modified: llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float-varargs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float-varargs.ll?rev=340626&r1=340625&r2=340626&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float-varargs.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float-varargs.ll Fri Aug 24 10:48:25 2018
@@ -111,7 +111,8 @@ entry:
 
 ; The first four arguments are the same in O32/N32/N64.
 ; The non-variable portion should be unaffected.
-; O32-DAG:           sw $4, 4([[R2]])
+; O32-DAG:           mtc1 $4, $f0
+; O32-DAG:           swc1 $f0, 4([[R2]])
 ; NEW-DAG:           swc1 $f12, 4([[R2]])
 
 ; The varargs portion is dumped to stack

Modified: llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float.ll?rev=340626&r1=340625&r2=340626&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/cconv/arguments-hard-float.ll Fri Aug 24 10:48:25 2018
@@ -125,9 +125,11 @@ entry:
 ; I've yet to find a reference in the documentation about this but GCC uses up
 ; the remaining two argument slots in the GPR's first. We'll do the same for
 ; compatibility.
-; O32-DAG:           sw $6, 12([[R1]])
+; O32-DAG:           mtc1 $6, $f0
+; O32-DAG:           swc1 $f0, 12([[R1]])
 ; NEW-DAG:           swc1 $f14, 12([[R1]])
-; O32-DAG:           sw $7, 16([[R1]])
+; O32-DAG:           mtc1 $7, $f0
+; O32-DAG:           swc1 $f0, 16([[R1]])
 ; NEW-DAG:           swc1 $f15, 16([[R1]])
 
 ; O32 is definitely out of registers now and switches to the stack.
@@ -207,5 +209,6 @@ entry:
 ; MD00305 and GCC disagree on this one. MD00305 says that floats are treated
 ; as 8-byte aligned and occupy two slots on O32. GCC is treating them as 4-byte
 ; aligned and occupying one slot. We'll use GCC's definition.
-; O32-DAG:           sw $5, 4([[R2]])
+; O32-DAG:           mtc1 $5, $f0
+; O32-DAG:           swc1 $f0, 4([[R2]])
 ; NEW-DAG:           swc1 $f13, 4([[R2]])




More information about the llvm-commits mailing list