diff options
author | Florian Hahn <flo@fhahn.com> | 2025-08-26 11:38:39 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2025-08-26 11:38:40 +0100 |
commit | b29084f0d80dd4fd66f1421350c87f79c537d071 (patch) | |
tree | de1c097e0276927a7b992e3077960bf889df7304 /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
parent | cdb18705fc81018303e1089bbae0a2ae2fd201af (diff) | |
download | llvm-b29084f0d80dd4fd66f1421350c87f79c537d071.zip llvm-b29084f0d80dd4fd66f1421350c87f79c537d071.tar.gz llvm-b29084f0d80dd4fd66f1421350c87f79c537d071.tar.bz2 |
[SCEVExp] Check if getPtrToIntExpr resulted in CouldNotCompute.
This fixes a crash trying to use SCEVCouldNotCompute, if getPtrToIntExpr
failed.
Fixes https://github.com/llvm/llvm-project/issues/155287
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 060ca92..3e3d51b 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -1239,10 +1239,13 @@ Value *SCEVExpander::tryToReuseLCSSAPhi(const SCEVAddRecExpr *S) { if (!isa<SCEVAddRecExpr>(ExitSCEV)) continue; Type *PhiTy = PN.getType(); - if (STy->isIntegerTy() && PhiTy->isPointerTy()) + if (STy->isIntegerTy() && PhiTy->isPointerTy()) { ExitSCEV = SE.getPtrToIntExpr(ExitSCEV, STy); - else if (S->getType() != PN.getType()) + if (isa<SCEVCouldNotCompute>(ExitSCEV)) + continue; + } else if (S->getType() != PN.getType()) { continue; + } // Check if we can re-use the existing PN, by adjusting it with an expanded // offset, if the offset is simpler. |