From 224cb82a39851c9d9f34c13c469c78e14ca4d8e4 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 16 Dec 2014 23:41:59 +0000 Subject: [PATCH] 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. llvm-svn: 224393 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 4 ++-- llvm/test/CodeGen/X86/switch-jump-table.ll | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 3c0229f..81b824f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2712,8 +2712,8 @@ void SelectionDAGBuilder::visitSwitch(const SwitchInst &SI) { !Cases.empty()) { // Replace an unreachable default destination with the most popular case // destination. - DenseMap Popularity; - uint64_t MaxPop = 0; + DenseMap Popularity; + unsigned MaxPop = 0; const BasicBlock *MaxBB = nullptr; for (auto I : SI.cases()) { const BasicBlock *BB = I.getCaseSuccessor(); diff --git a/llvm/test/CodeGen/X86/switch-jump-table.ll b/llvm/test/CodeGen/X86/switch-jump-table.ll index d1bd4bc..a84fb4a 100644 --- a/llvm/test/CodeGen/X86/switch-jump-table.ll +++ b/llvm/test/CodeGen/X86/switch-jump-table.ll @@ -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 -- 2.7.4