diff options
| author | Nikita Popov <npopov@redhat.com> | 2023-07-12 11:23:51 +0200 |
|---|---|---|
| committer | Nikita Popov <npopov@redhat.com> | 2023-07-12 11:32:13 +0200 |
| commit | d69033d245d4e129142b3908b8d406cdd897c9c9 (patch) | |
| tree | 0d122fae00cbfcb76f972abbaef2f5d4eac6dca2 /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
| parent | 7724c4b5a93e6f7d8c424181e8b576d683f3abb2 (diff) | |
| download | llvm-d69033d245d4e129142b3908b8d406cdd897c9c9.zip llvm-d69033d245d4e129142b3908b8d406cdd897c9c9.tar.gz llvm-d69033d245d4e129142b3908b8d406cdd897c9c9.tar.bz2 | |
[SCEVExpander] Fix GEP IV inc reuse logic for opaque pointers
Instead of checking the pointer type, check the element type of
the GEP.
Previously we ended up reusing GEP increments that were not in
expanded form, thus not respecting LSRs choice of representation.
The change in 2011-10-06-ReusePhi.ll recovers a regression that
appeared when converting that test to opaque pointers.
Changes in various Thumb tests now compute the step outside the
loop instead of using add.w inside the loop, which is LSR's
preferred representation for this target.
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 6200b4d..fe79097 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -999,15 +999,8 @@ Instruction *SCEVExpander::getIVIncOperand(Instruction *IncV, // allow any kind of GEP as long as it can be hoisted. continue; } - // This must be a pointer addition of constants (pretty), which is already - // handled, or some number of address-size elements (ugly). Ugly geps - // have 2 operands. i1* is used by the expander to represent an - // address-size element. - if (IncV->getNumOperands() != 2) - return nullptr; - unsigned AS = cast<PointerType>(IncV->getType())->getAddressSpace(); - if (IncV->getType() != Type::getInt1PtrTy(SE.getContext(), AS) - && IncV->getType() != Type::getInt8PtrTy(SE.getContext(), AS)) + // GEPs produced by SCEVExpander use i8 element type. + if (!cast<GEPOperator>(IncV)->getSourceElementType()->isIntegerTy(8)) return nullptr; break; } |
