<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - superlinear time in ARM instruction selection"
   href="https://llvm.org/bugs/show_bug.cgi?id=31124">31124</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>superlinear time in ARM instruction selection
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: ARM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nlewycky@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I have a testcase which looks like this:

void iTLB_bechmark_function() {
  int a = 0, b = 0;
  a = b + 1;
  b = a + 1;
  a = b + 1;
  b = a + 1;
  a = b + 1;
  b = a + 1;
  a = b + 1;
  b = a + 1;
// ...
  b = a + 1;
  a = b + 1;
  b = a + 1;
  a = b + 1;
  b = a + 1;
  a = b + 1;
  b = a + 1;
  a = b + 1;
  b = a + 1;
}

The unreduced testcase is 524291 lines long. With "clang -target
thumbv7-linux-gnueabi -S -o /dev/null iTLB_short.c -mthumb -ftime-report" we
can see that the ARM instruction selection is superlinear.

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  ---
Name ---
At 100 lines:
   0.0210 ( 68.7%)   0.0002 ( 54.8%)   0.0212 ( 68.6%)   0.0220 ( 70.2%)  ARM
Instruction Selection
At 1000 lines:
   0.2021 ( 78.8%)   0.0034 (100.0%)   0.2055 ( 79.1%)   0.2060 ( 79.3%)  ARM
Instruction Selection
At 10000 lines:
   8.0935 ( 93.9%)   0.0120 (100.0%)   8.1055 ( 93.9%)   8.1029 ( 93.9%)  ARM
Instruction Selection
At 100000 lines:
  1541.2256 ( 99.7%)   0.7040 ( 97.2%)  1541.9296 ( 99.7%)  1541.8429 ( 99.7%) 
ARM Instruction Selection

Version: clang version 4.0.0 (trunk 287592) (llvm/trunk 287591)

Here's a sample backtrace:

#0  0x0000000001ca3d9c in llvm::SDNode::getOpcode (this=0x1113c400) at
/usr/local/google/home/nlewycky/llvm/src/include/llvm/CodeGen/SelectionDAGNodes.h:541
#1  0x00000000040c195c in (anonymous
namespace)::DAGCombiner::CombineToPostIndexedLoadStore (this=0x7fffffffa930,
N=0x10fa9710) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:10090
#2  0x00000000040c3409 in (anonymous namespace)::DAGCombiner::visitLOAD
(this=0x7fffffffa930, N=0x10fa9710) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:10333
#3  0x0000000004083a03 in (anonymous namespace)::DAGCombiner::visit
(this=0x7fffffffa930, N=0x10fa9710) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1459
#4  0x0000000004083bad in (anonymous namespace)::DAGCombiner::combine
(this=0x7fffffffa930, N=0x10fa9710) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1480
#5  0x0000000004082f9c in (anonymous namespace)::DAGCombiner::Run
(this=0x7fffffffa930, AtLevel=llvm::AfterLegalizeDAG) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1334
#6  0x00000000040e2ce6 in llvm::SelectionDAG::Combine (this=0xdd44020,
Level=llvm::AfterLegalizeDAG, AA=..., OptLevel=llvm::CodeGenOpt::None) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15464
#7  0x00000000041c91eb in llvm::SelectionDAGISel::CodeGenAndEmitDAG
(this=0xa71ae10) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:844
#8  0x00000000041c7e18 in llvm::SelectionDAGISel::SelectBasicBlock
(this=0xa71ae10, Begin=..., End=..., HadTailCall=@0x7fffffffb010: false) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:683
#9  0x00000000041cc592 in llvm::SelectionDAGISel::SelectAllBasicBlocks
(this=0xa71ae10, Fn=...) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1558
#10 0x00000000041c6d04 in llvm::SelectionDAGISel::runOnMachineFunction
(this=0xa71ae10, mf=...) at
/usr/local/google/home/nlewycky/llvm/src/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:504
#11 0x00000000020b2ab4 in (anonymous
namespace)::ARMDAGToDAGISel::runOnMachineFunction (this=0xa71ae10, MF=...) at
/usr/local/google/home/nlewycky/llvm/src/lib/Target/ARM/ARMISelDAGToDAG.cpp:69
[...]

I don't know why, but it's only superlinear with arm+thumb, not on arm or on
x86.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>