[llvm] r358502 - [DAGCombiner] Add missing flag to addressing mode check

Luis Marques via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 08:09:18 PDT 2019


Author: luismarques
Date: Tue Apr 16 08:09:18 2019
New Revision: 358502

URL: http://llvm.org/viewvc/llvm-project?rev=358502&view=rev
Log:
[DAGCombiner] Add missing flag to addressing mode check

The checks in `canFoldInAddressingMode` tested for addressing modes that have a
base register but didn't set the `HasBaseReg` flag to true (it's false by
default). This patch fixes that. Although the omission of the flag was
technically incorrect it had no known observable impact, so no tests were
changed by this patch.

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

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=358502&r1=358501&r2=358502&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Apr 16 08:09:18 2019
@@ -12897,6 +12897,7 @@ static bool canFoldInAddressingMode(SDNo
 
   TargetLowering::AddrMode AM;
   if (N->getOpcode() == ISD::ADD) {
+    AM.HasBaseReg = true;
     ConstantSDNode *Offset = dyn_cast<ConstantSDNode>(N->getOperand(1));
     if (Offset)
       // [reg +/- imm]
@@ -12905,6 +12906,7 @@ static bool canFoldInAddressingMode(SDNo
       // [reg +/- reg]
       AM.Scale = 1;
   } else if (N->getOpcode() == ISD::SUB) {
+    AM.HasBaseReg = true;
     ConstantSDNode *Offset = dyn_cast<ConstantSDNode>(N->getOperand(1));
     if (Offset)
       // [reg +/- imm]




More information about the llvm-commits mailing list