-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PPC] Diamond if-converter fails when two BB terminate in ret instead of branches. #36173
Comments
I should have added that this is with https://reviews.llvm.org/D43781 backported to 6.0.0 |
Any suggestions/hints how I can isolate this bug or how I can help with debugging? |
Valentin, perhaps it would be good if you can provide instructions on how I can set up an environment similar to yours (what to download, build, run) and I can try to investigate as well. It is definitely difficult to investigate when we can't reproduce it with llc, but hopefully we can make some sense out of it. |
Nemanja, that I can certainly do. Let me know if you run into any issues git clone https://github.com/JuliaLang/julia This will build all the necessary dependencies including LLVMall the llvm tooling will be in ./usr/toolsYou will want to apply the following patch before continuing: So that you can pass JULIA_LLVM_ARGS in the environment to dump IR, etc. make -j16 julia-base-compiler This will compile the julia compiler and add a ./usr/lib/libjulia.sowhich can be loaded by opt to get access to the Julia specific LLVM passesmake VERBOSE=1 julia-sysimg-release # towards the end of this you should hit the seqfault |
reduced mir test-case llc -mtriple=powerpc64le-unknown-linux-gnu -fast-isel=0 -code-model=medium -mcpu=pwr8 -relocation-model=static -emulated-tls -run-pass=if-converter -debug-only=if-converter if-conversion.mir |
Thanks to @vtjnash we managed to pinpoint the failure and construct a test-case. Upon closer inspects the two BB blocks that were deemed eligible for diamond if conversion terminated in return statements and not branches. But the if-converter pass looks expects that BB are terminated by branches. |
test case for trunk I also proposed a minimal fix at https://reviews.llvm.org/D45218 |
I don't think there's a really good reason to stop if-conversion when we've encountered a function return. The patch certainly causes a number of test cases to fail when I apply it and try it (at least one fails with a crash). The problem in this case seems to be that the two blocks are identical. What will happen in-turn is that we will erase all the instructions out of both blocks. So this is certainly something we'd want to do. I think we can fix this by noticing that the two blocks are empty after the splice/erase operations and just get rid of them. The below patch fixes the reduced test case for me and introduces no new failures. Could you try this patch to see if it solves the problem: Index: lib/CodeGen/IfConversion.cpp--- lib/CodeGen/IfConversion.cpp (revision 328620)
|
You are right. I forgot to enable all the other targets in my build and didn't see the other test failures. Sorry about that. Your approach is similar to my first attempt at mitigating this, but I didn't think of just eliminating the two BBs, but I think the patch would need to be: diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
Should I update my diff or do you want to commit it with an appropriate test-case? |
If you don't mind updating, that would be great. I'd certainly like to get this reviewed. |
Fixed by https://reviews.llvm.org/rL330345 |
*** Bug #35355 has been marked as a duplicate of this bug. *** |
*** Bug #29594 has been marked as a duplicate of this bug. *** |
*** Bug #32860 has been marked as a duplicate of this bug. *** |
Extended Description
Found while upgrading the Julia frontend to LLVM 6.0.
I am failing to isolate this failure for the last two weeks (also see http://lists.llvm.org/pipermail/llvm-dev/2018-March/121932.html)
I nailed it down to the function
japi1__require_7687
(in gdbMF->getName
) and I put the log online (124MB) https://drive.google.com/open?id=1Br0s9Qvr4tzPv8nqbnV_nWezpEH5Ci7BThe setup of the target machine is roughly equivalent to:
and the last Julia specific pass in the log is LowerPTLS. So a pipeline starting from
bool-ret-to-int
should be able to re-trigger the assertion, but to no avail.I compared the output of
debug-pass=Arguments
and the only difference between the pipeline used byllc
andjulia
postbool-ret-to-int
is:Note the additional
isel
in the llc pipeline that is missing in Julia, but I can't find a reason why that would be true.Some other breadcrumps:
The text was updated successfully, but these errors were encountered: