llvm.org GIT mirror llvm / 834b93c
[sanitizer-coverage] sort the switch cases git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290628 91177308-0d34-0410-b5e6-96231b3b80d8 Kostya Serebryany 3 years ago
2 changed file(s) with 7 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
600600 C = ConstantExpr::getCast(CastInst::ZExt, It.getCaseValue(), Int64Ty);
601601 Initializers.push_back(C);
602602 }
603 std::sort(Initializers.begin() + 2, Initializers.end(),
604 [](const Constant *A, const Constant *B) {
605 return cast(A)->getLimitedValue() <
606 cast(B)->getLimitedValue();
607 });
603608 ArrayType *ArrayOfInt64Ty = ArrayType::get(Int64Ty, Initializers.size());
604609 GlobalVariable *GV = new GlobalVariable(
605610 *CurModule, ArrayOfInt64Ty, false, GlobalVariable::InternalLinkage,
1010 ; CHECK-NEXT: call void @__sanitizer_cov_trace_switch(i64 [[TMP]], i64* getelementptr inbounds ([5 x i64], [5 x i64]* @__sancov_gen_cov_switch_values, i32 0, i32 0))
1111 switch i32 %x, label %sw.epilog [
1212 i32 1, label %sw.bb
13 i32 101, label %sw.bb.1
14 i32 1001, label %sw.bb.2
13 i32 1001, label %sw.bb.1
14 i32 101, label %sw.bb.2
1515 ]
1616
1717 sw.bb: ; preds = %entry