[PATCH] D91781: [VE] Add regression test for D91151
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 19 18:55:42 PST 2020
dblaikie added a comment.
In D91781#2406553 <https://reviews.llvm.org/D91781#2406553>, @kaz7 wrote:
> In D91781#2406521 <https://reviews.llvm.org/D91781#2406521>, @dblaikie wrote:
>
>> with assertions enabled/if the old code asserting, you may be able to simplify the test case down much further, as the assertion will ensure a more reliable/fast failure rather than some unspecified failure due to undefined behavior in the execution later on/elsewhere.
>
> That's make sens. However, cast mechanism is compilcated and I couldn't find any good way to simplify this test case. Anyway, this is an assertion message and some back trace from old code.
>
> llc: /home/jam/llvm-upstream/llvm-project/llvm/include/llvm/Support/Casting.h:262: typename llvm::cast_retty<To, From>::ret_type llvm::cast(Y&) [with X = llvm::ConstantSDNode; Y = llvm::SDValue; typename llvm::cast_retty<To, From>::ret_type = llvm::ConstantSDNode*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
> ...
> #6 0x00007fbf5a26b859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x25859)
> #7 0x00007fbf5a26b729 (/lib/x86_64-linux-gnu/libc.so.6+0x25729)
> #8 0x00007fbf5a27cf36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
> #9 0x0000559f57608668 llvm::cast_retty<llvm::ConstantSDNode, llvm::SDValue>::ret_type llvm::cast<llvm::ConstantSDNode, llvm::SDValue>(llvm::SDValue&) /home/jam/llvm-upstream/llvm-project/llvm/include/llvm/Support/Casting.h:262:3
> #10 0x0000559f5792a5af (anonymous namespace)::VEDAGToDAGISel::selectADDRzii(llvm::SDValue, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) /home/jam/llvm-upstream/llvm-project/llvm/lib/Target/VE/VEISelDAGToDAG.cpp:230:38
> #11 0x0000559f5792965d (anonymous namespace)::VEDAGToDAGISel::CheckComplexPattern(llvm::SDNode*, llvm::SDNode*, llvm::SDValue, unsigned int, llvm::SmallVectorImpl<std::pair<llvm::SDValue, llvm::SDNode*> >&) /home/jam/llvm-upstream/build-debug/lib/Target/VE/VEGenDAGISel.inc:11266:100
With the use of CReduce <https://embed.cs.utah.edu/creduce/> & some manual reduction, I managed to get the test down to this:
define i32 @a(i32* %b) {
if.c:
%d = load atomic i32, i32* %b monotonic, align 4
switch i32 %d, label %e.default [
i32 1, label %e.bb
i32 2, label %e.f
i32 4, label %e.g
i32 0, label %if.end
]
e.bb:
br label %if.end
e.f:
br label %if.end
e.g:
br label %if.end
e.default:
br label %if.end
if.end:
%ret.0 = phi i32
[ 0, %e.default ],
[ 6, %if.c ],
[ 0, %e.g ],
[ 1, %e.f ],
[ 1, %e.bb ]
ret i32 %ret.0
}
Though it'd be good if you could check this over and ensure this test makes sense for the failure - and see if there's any domain-specific knowledge you could apply to change if it could be modified/simplified/be more explicit about how/why this code is what's needed to reach the buggy case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91781/new/
https://reviews.llvm.org/D91781
More information about the llvm-commits
mailing list