[PATCH] D29088: Do not create ctlz/cttz(X, false) when the target do not support zero defined ctlz/cttz.

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 16:41:03 PST 2017


deadalnix added a comment.

I have one case that boils down to this for instance:

  define i64 @_D2gc1d4util6decodeFMKAxhZm({ i64, i8* }* nocapture readonly %data) local_unnamed_addr #2 {
  entry:
    %0 = getelementptr inbounds { i64, i8* }, { i64, i8* }* %data, i64 0, i32 1
    %1 = load i8*, i8** %0, align 8
    %2 = load i8, i8* %1, align 1
    %3 = icmp eq i8 %2, -1
    br i1 %3, label %then, label %endif
  
  then:                                             ; preds = %entry
    ret i64 23
  
  endif:                                            ; preds = %entry
    %4 = xor i8 %2, -1
    %5 = tail call i8 @llvm.ctlz.i8(i8 %4, i1 false)
    %6 = zext i8 %5 to i64
    ret i64 %6
  }

This doesn't optimize further.


https://reviews.llvm.org/D29088





More information about the llvm-commits mailing list