[PATCH] D32521: [ValueTracking] Use KnownOnes to provide a better bound on known zeros for ctlz/cttz intrinics

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 08:01:25 PDT 2017


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/intrinsics.ll:304-312
 define i1 @ctlz_knownbits(i8 %arg) {
 ; CHECK-LABEL: @ctlz_knownbits(
-; CHECK-NEXT:    [[OR:%.*]] = or i8 [[ARG:%.*]], 32
-; CHECK-NEXT:    [[CNT:%.*]] = call i8 @llvm.ctlz.i8(i8 [[OR]], i1 true) #0
-; CHECK-NEXT:    [[RES:%.*]] = icmp eq i8 [[CNT]], 4
-; CHECK-NEXT:    ret i1 [[RES]]
+; CHECK-NEXT:    ret i1 false
 ;
   %or = or i8 %arg, 32
   %cnt = call i8 @llvm.ctlz.i8(i8 %or, i1 true) nounwind readnone
   %res = icmp eq i8 %cnt, 4
----------------
Can you add a negative test for each of ctlz/cttz?
That would be "icmp eq i8 %cnt, 2" for this case if I'm reading it correctly.


https://reviews.llvm.org/D32521





More information about the llvm-commits mailing list