[llvm] r224393 - SelectionDAG switch lowering: use 'unsigned' to count destination popularity

Hans Wennborg hans at hanshq.net
Tue Dec 16 15:42:00 PST 2014


Author: hans
Date: Tue Dec 16 17:41:59 2014
New Revision: 224393

URL: http://llvm.org/viewvc/llvm-project?rev=224393&view=rev
Log:
SelectionDAG switch lowering: use 'unsigned' to count destination popularity

SwitchInst::getNumCases() returns unsinged, so using uint64_t to count cases
seems unnecessary.

Also fix a missing CHECK in the test case.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    llvm/trunk/test/CodeGen/X86/switch-jump-table.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=224393&r1=224392&r2=224393&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Dec 16 17:41:59 2014
@@ -2712,8 +2712,8 @@ void SelectionDAGBuilder::visitSwitch(co
       !Cases.empty()) {
     // Replace an unreachable default destination with the most popular case
     // destination.
-    DenseMap<const BasicBlock *, uint64_t> Popularity;
-    uint64_t MaxPop = 0;
+    DenseMap<const BasicBlock *, unsigned> Popularity;
+    unsigned MaxPop = 0;
     const BasicBlock *MaxBB = nullptr;
     for (auto I : SI.cases()) {
       const BasicBlock *BB = I.getCaseSuccessor();

Modified: llvm/trunk/test/CodeGen/X86/switch-jump-table.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/switch-jump-table.ll?rev=224393&r1=224392&r2=224393&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/switch-jump-table.ll (original)
+++ llvm/trunk/test/CodeGen/X86/switch-jump-table.ll Tue Dec 16 17:41:59 2014
@@ -6,7 +6,7 @@
 define void @sum2(i32 %x, i32* %to) {
 ; CHECK-LABEL: sum2:
 ; CHECK: movl 4(%esp), [[REG:%e[a-z]{2}]]
-; cmpl $3, [[REG]]
+; CHECK: cmpl $3, [[REG]]
 ; CHECK: jbe .LBB0_1
 ; CHECK: movl $4
 ; CHECK: retl





More information about the llvm-commits mailing list