llvm.org GIT mirror llvm / c4eab90
Teach the verifier to reject all non-constant arguments to the second argument of the cttz and ctlz intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146360 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 8 years ago
2 changed file(s) with 22 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
16871687 switch (ID) {
16881688 default:
16891689 break;
1690 case Intrinsic::ctlz: // llvm.ctlz
1691 case Intrinsic::cttz: // llvm.cttz
1692 Assert1(isa(CI.getArgOperand(1)),
1693 "is_zero_undef argument of bit counting intrinsics must be a "
1694 "constant int", &CI);
1695 break;
16901696 case Intrinsic::dbg_declare: { // llvm.dbg.declare
16911697 Assert1(CI.getArgOperand(0) && isa(CI.getArgOperand(0)),
16921698 "invalid llvm.dbg.declare intrinsic call 1", &CI);
0 ; RUN: not llvm-as < %s -o /dev/null |& FileCheck %s
1
2 declare i32 @llvm.ctlz.i32(i32, i1)
3 declare i32 @llvm.cttz.i32(i32, i1)
4
5 define void @f(i32 %x, i1 %is_not_zero) {
6 entry:
7 ; CHECK: is_zero_undef argument of bit counting intrinsics must be a constant int
8 ; CHECK-NEXT: @llvm.ctlz.i32
9 call i32 @llvm.ctlz.i32(i32 %x, i1 %is_not_zero)
10
11 ; CHECK: is_zero_undef argument of bit counting intrinsics must be a constant int
12 ; CHECK-NEXT: @llvm.cttz.i32
13 call i32 @llvm.cttz.i32(i32 %x, i1 %is_not_zero)
14 ret void
15 }