-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
LTO error: Instruction does not dominate all uses #109333
Labels
LTO
Link time optimization (regular/full LTO or ThinLTO)
Comments
While bisecting using this reduced test case, I was able to reproduce this crash on several versions of LLVM between 15 and 18.1.8. I was also able to reproduce on the tip of
specifically, this (almost) 1-line diff diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 4b2db80bc1ec..3b73f9511eca 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -6023,8 +6023,13 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) {
if (const SCEV *S = createAddRecFromPHI(PN))
return S;
+ // If the PHI has a single incoming value, follow that value, unless the
+ // PHI's incoming blocks are in a different loop, in which case doing so
+ // risks breaking LCSSA form. Instcombine would normally zap these, but
+ // it doesn't have DominatorTree information, so it may miss cases.
if (Value *V = simplifyInstruction(PN, {getDataLayout(), &TLI, &DT, &AC}))
- return getSCEV(V);
+ if (LI.replacementPreservesLCSSAForm(PN, V))
+ return getSCEV(V);
if (const SCEV *S = createNodeFromSelectLikePHI(PN))
return S; |
EugeneZelenko
added
LTO
Link time optimization (regular/full LTO or ThinLTO)
and removed
new issue
labels
Sep 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clang crashes while linking
I followed the instructions here and narrowed it down to an LTO bug. File to reproduce is attached. a.out.0.2.internalize-reduced.bc.tar.gz
This happened after adding
-fsplit-lto-unit
to some parts of my code base.The text was updated successfully, but these errors were encountered: