[PATCH] D90382: [InstCombine] foldSelectRotate - generalize to foldSelectFunnelShift
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 5 04:19:25 PST 2020
nlopes added a comment.
Alive2 says this test is incorrect (because `select` blocks poison and funnel shift doesn't):
define i8 @fshr_select(i8 %x, i8 %y, i8 %shamt) {
%0:
%cmp = icmp eq i8 %shamt, 0
%sub = sub i8 8, %shamt
%shr = lshr i8 %y, %shamt
%shl = shl i8 %x, %sub
%or = or i8 %shl, %shr
%r = select i1 %cmp, i8 %y, i8 %or
ret i8 %r
}
=>
define i8 @fshr_select(i8 %x, i8 %y, i8 %shamt) {
%0:
%r = fshr i8 %x, i8 %y, i8 %shamt
ret i8 %r
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source
Example:
i8 %x = poison
i8 %y = any
i8 %shamt = #x00 (0)
Source:
i1 %cmp = #x1 (1)
i8 %sub = #x08 (8)
i8 %shr = any
i8 %shl = poison
i8 %or = poison
i8 %r = any
Target:
i8 %r = poison
Source value: any
Target value: poison
https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=bdd9860ccefdbd55&test=Transforms%2FInstCombine%2Ffunnel.ll
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90382/new/
https://reviews.llvm.org/D90382
More information about the llvm-commits
mailing list