diff options
author | Patrick O'Neill <102189596+patrick-rivos@users.noreply.github.com> | 2024-03-04 16:40:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 16:40:40 -0800 |
commit | 8d6e867eb2de32ce28ece972c91405db976192c3 (patch) | |
tree | f6c17dac077e9fad023524ad289e227f0c6f7025 /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | bdfebc310e67c8e96909e155669277ab75d784ba (diff) | |
download | llvm-8d6e867eb2de32ce28ece972c91405db976192c3.zip llvm-8d6e867eb2de32ce28ece972c91405db976192c3.tar.gz llvm-8d6e867eb2de32ce28ece972c91405db976192c3.tar.bz2 |
[LSR][term-fold] Ensure the simple recurrence is from the current loop (#83085)
If the phi node found by matchSimpleRecurrence is not from the current
loop, then isAlmostDeadIV panics. With this patch we bail out early.
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
---------
Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index a4fdc1f..7491a99 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -468,6 +468,7 @@ llvm::collectChildrenInLoop(DomTreeNode *N, const Loop *CurLoop) { bool llvm::isAlmostDeadIV(PHINode *PN, BasicBlock *LatchBlock, Value *Cond) { int LatchIdx = PN->getBasicBlockIndex(LatchBlock); + assert(LatchIdx != -1 && "LatchBlock is not a case in this PHINode"); Value *IncV = PN->getIncomingValue(LatchIdx); for (User *U : PN->users()) |