[PATCH] D149077: [InstCombine] Add !noundef if is guaranteed do not violate !range
luxufan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 04:54:01 PDT 2023
StephenFan added a comment.
In D149077#4294864 <https://reviews.llvm.org/D149077#4294864>, @nikic wrote:
> Can you please explain what the larger motivation for this is? Can you show the whole pattern you're trying to optimize? I really don't want to do this without strong motivation.
>
> Also, the `!noundef` metadata should be a `noundef` attribute. Actually, this should be enforced by the verifier the same way it is for `!nonull` and `!align`, it looks like we're missing a check.
The larger motivation is we can't instcombine `%r = select i1 %b, i1 %cmp, i1 false` to `%r = and i1 %b, %cmp` in the following example. And it caused code size regressions on lzbench https://github.com/dtcxzyw/llvm-ci/issues/135 .
define i1 @poison_metadata(i32 noundef %a, i1 %b) {
%c = call i32 @llvm.ctpop.i32(i32 %a), !range !0
%cmp = icmp ugt i32 %c, 2
%r = select i1 %b, i1 %cmp, i1 false
ret i1 %r
}
!0 = !{i32 0, i32 4}
!1 = !{}
declare i32 @llvm.ctpop.i32(i32)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149077/new/
https://reviews.llvm.org/D149077
More information about the llvm-commits
mailing list