SelectionDAG switch lowering: use 'unsigned' to count destination popularity
authorHans Wennborg <hans@hanshq.net>
Tue, 16 Dec 2014 23:41:59 +0000 (23:41 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 16 Dec 2014 23:41:59 +0000 (23:41 +0000)
SwitchInst::getNumCases() returns unsinged, so using uint64_t to count cases
seems unnecessary.

Also fix a missing CHECK in the test case.

llvm-svn: 224393

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

index 3c0229f..81b824f 100644 (file)
@@ -2712,8 +2712,8 @@ void SelectionDAGBuilder::visitSwitch(const SwitchInst &SI) {
       !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();
index d1bd4bc..a84fb4a 100644 (file)
@@ -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