[PATCH] D116398: [SelectionDAG][RISCV] Add preferred extend of value used for PHI node
Haocong Lu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 3 22:45:52 PST 2022
Luhaocong added a comment.
In D116398#3214097 <https://reviews.llvm.org/D116398#3214097>, @jrtc27 wrote:
> The test case is quite complicated for what should be a simple thing to test. and is rather redundant in its IR; ignoring the nsw aspect, sext+sub+trunc is just sub of the smaller type, and the sext+icmp can just be icmp of the smaller type. Changing the latter seems to have no effect on the generated code, but for whatever reason changing the former to just sub on i16 already sign-extends at the computation site. Also, your `; preds` comments don't belong in IR tests, and the naming looks like you just took Clang output and hacked it into a test.
>
> define signext i16 @foo(i16 signext %a, i1 zeroext %b) {
> entry:
> br i1 %b, label %add, label %ret
>
> add:
> %0 = add i16 %a, 1
> br label %ret
>
> ret:
> %1 = phi i16 [ %a, %entry ], [ %0, %add ]
> ret i16 %1
> }
>
> is a much simpler from-scratch test that should show the behaviour you want.
Thanks for your professional guidance,I will focus more on simplifying test cases
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116398/new/
https://reviews.llvm.org/D116398
More information about the llvm-commits
mailing list