History log of /llvm-project/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp (Results 76 – 100 of 190)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 9247b012 29-Sep-2022 Florian Hahn <flo@fhahn.com>

[SCEVExpander] Use CreateBitOrPointerCast instead of builder (NFC).

Simplify the code by using CastInst::CreateBitOrPointerCast directly. By
not going through the builder, the temporary instruction

[SCEVExpander] Use CreateBitOrPointerCast instead of builder (NFC).

Simplify the code by using CastInst::CreateBitOrPointerCast directly. By
not going through the builder, the temporary instruction also won't get
registered in InsertedValues & co, which means less work overall and
simplifies the clean-up.

show more ...


# ed47bc8b 28-Sep-2022 Florian Hahn <flo@fhahn.com>

[SCEVExpander] Remove dead Root argument from expandCodeForImpl (NFC).

The argument is unused and can be removed.


Revision tags: llvmorg-15.0.1
# 86d5586d 13-Sep-2022 Max Kazantsev <mkazantsev@azul.com>

[SCEVExpander] Recompute poison-generating flags on hoisting. PR57187

Instruction being hoisted could have nuw/nsw flags inferred from the old
context, and we cannot simply move it to the new locati

[SCEVExpander] Recompute poison-generating flags on hoisting. PR57187

Instruction being hoisted could have nuw/nsw flags inferred from the old
context, and we cannot simply move it to the new location keeping them
because we are going to introduce new uses to them that didn't exist before.

Example in https://github.com/llvm/llvm-project/issues/57187 shows how
this can produce branch by poison from initially well-defined program.

This patch forcefully recomputes poison-generating flag in the new context.

Differential Revision: https://reviews.llvm.org/D132022
Reviewed By: fhahn, nikic

show more ...


# b51c6130 10-Sep-2022 Manuel Brito <manuel.brito@tecnico.ulisboa.pt>

Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC]

Replacing the following instances of UndefValue with PoisonValue, where the UndefValue is used as an arbitrary value:

- llv

Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC]

Replacing the following instances of UndefValue with PoisonValue, where the UndefValue is used as an arbitrary value:

- llvm/lib/CodeGen/WinEHPrepare.cpp
`demotePHIsOnFunclets`: RAUW arbitrary value for lingering uses of removed PHI nodes

- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
`FoldSingleEntryPHINodes`: Removes a self-referential single entry phi node.

- llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
`finalize`: Remove all references to removed functions.

- llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
`cleanup`: the result is not used then the inserted instructions are removed.

- llvm/tools/bugpoint/CrashDebugger.cpp
`TestInts`: the program is cloned and instructions are removed to narrow down source of crash.

Differential Revision: https://reviews.llvm.org/D133640

show more ...


Revision tags: llvmorg-15.0.0, llvmorg-15.0.0-rc3
# 109df7f9 13-Aug-2022 Kazu Hirata <kazu@google.com>

[llvm] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.


Revision tags: llvmorg-15.0.0-rc2
# a2d45017 07-Aug-2022 Kazu Hirata <kazu@google.com>

[llvm] Fix comment typos (NFC)


Revision tags: llvmorg-15.0.0-rc1, llvmorg-16-init
# f75ccadc 14-Jul-2022 Nikita Popov <npopov@redhat.com>

[LSR] Create SCEVExpander earlier, use member isSafeToExpand() (NFC)

This is a followup to D129630, which switches LSR to the member
isSafeToExpand() variant, and removes the freestanding function.

[LSR] Create SCEVExpander earlier, use member isSafeToExpand() (NFC)

This is a followup to D129630, which switches LSR to the member
isSafeToExpand() variant, and removes the freestanding function.

This is done by creating the SCEVExpander early (already during the
analysis phase). Because the SCEVExpander is now available for the
whole lifetime of LSRInstance, I've also made it into a member
variable, rather than passing it around in even more places.

Differential Revision: https://reviews.llvm.org/D129769

show more ...


# 3bc09c7d 14-Jul-2022 Philip Reames <preames@rivosinc.com>

[SCEVExpander] Allow udiv with isKnownNonZero(RHS) + add vscale case

Motivation here is to unblock LSRs ability to use ICmpZero uses - the major effect of which is to enable count down IVs. The test

[SCEVExpander] Allow udiv with isKnownNonZero(RHS) + add vscale case

Motivation here is to unblock LSRs ability to use ICmpZero uses - the major effect of which is to enable count down IVs. The test changes reflect this goal, but the potential impact is much broader since this isn't a change in LSR at all.

SCEVExpander needs(*) to prove that expanding the expression is safe anywhere the SCEV expression is valid. In general, we can't expand any node which might fault (or exhibit UB) unless we can either a) prove it won't fault, or b) guard the faulting case. We'd been allowing non-zero constants here; this change extends it to non-zero values.

vscale is never zero. This is already implemented in ValueTracking, and this change just adds the same logic in SCEV's range computation (which in turn drives isKnownNonZero). We should common up some logic here, but let's do that in separate changes.

(*) As an aside, "needs" is such an interesting word here. First, we don't actually need to guard this at all; we could choose to emit a select for the RHS of ever udiv and remove this code entirely. Secondly, the property being checked here is way too strong. What the client actually needs is to expand the SCEV at some particular point in some particular loop. In the examples, the original urem dominates that loop and yet we completely ignore that information when analyzing legality. I don't plan to actively pursue either direction, just noting it for future reference.

Differential Revision: https://reviews.llvm.org/D129710

show more ...


# 9e6e631b 14-Jul-2022 Nikita Popov <npopov@redhat.com>

[LoopPredication] Use isSafeToExpandAt() member function (NFC)

As a followup to D129630, this switches a usage of the freestanding
function in LoopPredication to use the member variant instead. This

[LoopPredication] Use isSafeToExpandAt() member function (NFC)

As a followup to D129630, this switches a usage of the freestanding
function in LoopPredication to use the member variant instead. This
was the last use of the freestanding function, so drop it entirely.

show more ...


# dcf4b733 13-Jul-2022 Nikita Popov <npopov@redhat.com>

[SCEVExpander] Make CanonicalMode handing in isSafeToExpand() more robust (PR50506)

isSafeToExpand() for addrecs depends on whether the SCEVExpander
will be used in CanonicalMode. At least one calle

[SCEVExpander] Make CanonicalMode handing in isSafeToExpand() more robust (PR50506)

isSafeToExpand() for addrecs depends on whether the SCEVExpander
will be used in CanonicalMode. At least one caller currently gets
this wrong, resulting in PR50506.

Fix this by a) making the CanonicalMode argument on the freestanding
functions required and b) adding member functions on SCEVExpander
that automatically take the SCEVExpander mode into account. We can
use the latter variant nearly everywhere, and thus make sure that
there is no chance of CanonicalMode mismatch.

Fixes https://github.com/llvm/llvm-project/issues/50506.

Differential Revision: https://reviews.llvm.org/D129630

show more ...


# 32a76fc2 04-Jul-2022 Nikita Popov <npopov@redhat.com>

[SCEVExpander] Avoid ConstantExpr::get() (NFCI)

Use ConstantFoldBinaryOpOperands() instead. This will be important
when not all binops have constant expression variants.


# f34dcf27 30-Jun-2022 Nikita Popov <npopov@redhat.com>

[IRBuilder] Migrate all binops to folding API

Migrate all binops to use FoldXYZ rather than CreateXYZ APIs,
which are compatible with InstSimplifyFolder and fallible constant
folding.

Rather than c

[IRBuilder] Migrate all binops to folding API

Migrate all binops to use FoldXYZ rather than CreateXYZ APIs,
which are compatible with InstSimplifyFolder and fallible constant
folding.

Rather than continuing to add one method for every single operator,
add a generic FoldBinOp (plus variants for nowrap, exact and fmf
operators), which we would need anyway for CreateBinaryOp.

This change is not NFC because IRBuilder with InstSimplifyFolder
may perform more folding. However, this patch changes SCEVExpander
to not use the folder in InsertBinOp to minimize practical impact
and keep this change as close to NFC as possible.

show more ...


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5
# b8c2781f 09-Jun-2022 Simon Moll <moll@cs.uni-saarland.de>

[NFC] format InstructionSimplify & lowerCaseFunctionNames

Clang-format InstructionSimplify and convert all "FunctionName"s to
"functionName". This patch does touch a lot of files but gets done with

[NFC] format InstructionSimplify & lowerCaseFunctionNames

Clang-format InstructionSimplify and convert all "FunctionName"s to
"functionName". This patch does touch a lot of files but gets done with
the cleanup of InstructionSimplify in one commit.

This is the alternative to the less invasive clang-format only patch: D126783

Reviewed By: spatel, rengolin

Differential Revision: https://reviews.llvm.org/D126889

show more ...


# 0e10f128 08-Jun-2022 Chuanqi Xu <yedeng.yd@linux.alibaba.com>

[NFC] Remove commented cerr debugging loggings

There are some unused cerr debugging loggings in the codes. It is weird
to remain such commented debug helpers in the product.


Revision tags: llvmorg-14.0.4
# e9a1c82d 11-May-2022 Nikita Popov <npopov@redhat.com>

[SCEVExpander] Expand umin_seq using freeze

%x umin_seq %y is currently expanded to %x == 0 ? 0 : umin(%x, %y).
This patch changes the expansion to umin(%x, freeze %y) instead
(https://alive2.llvm.o

[SCEVExpander] Expand umin_seq using freeze

%x umin_seq %y is currently expanded to %x == 0 ? 0 : umin(%x, %y).
This patch changes the expansion to umin(%x, freeze %y) instead
(https://alive2.llvm.org/ce/z/wujUhp).

The motivation for this change are the test cases affected by
D124910, where the freeze expansion ultimately produces better
optimization results. This is largely because
`(%x umin_seq %y) == %x` is a common expansion pattern, which
reliably optimizes in freeze representation, but only sometimes
with the zero comparison (in particular, if %x == 0 can fold to
something else, we generally won't be able to cover reasonable
code from this.)

Differential Revision: https://reviews.llvm.org/D125372

show more ...


# c1bb4a88 11-May-2022 Nikita Popov <npopov@redhat.com>

[SCEVExpander] Deduplicate min/max expansion code (NFC)


# 0eafef11 10-May-2022 Nikita Popov <npopov@redhat.com>

[SCEVExpander] Remove handling for mixed int/pointer min/max (NFCI)

Mixed int/pointer min/max are no longer possible.


Revision tags: llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2
# a494ae43 01-Mar-2022 serge-sans-paille <sguelton@redhat.com>

Cleanup includes: TransformsUtils

Estimation on the impact on preprocessor output:
before: 1065307662
after: 1064800684

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-

Cleanup includes: TransformsUtils

Estimation on the impact on preprocessor output:
before: 1065307662
after: 1064800684

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120741

show more ...


# 16a2d5f8 25-Feb-2022 Nikita Popov <npopov@redhat.com>

[SCEVExpander] Use early returns in FindValueInExprValueMap() (NFC)


# 2d0fc3e4 25-Feb-2022 Nikita Popov <npopov@redhat.com>

[SCEV] Return ArrayRef from getSCEVValues() (NFC)

Return a read-only view on this set. For the one internal use,
directly access ExprValueMap.


# d9715a72 22-Feb-2022 Nikita Popov <npopov@redhat.com>

[SCEV] Don't try to reuse expressions with offset

SCEVs ExprValueMap currently tracks not only which IR Values
correspond to a given SCEV expression, but additionally stores that
it may be expanded

[SCEV] Don't try to reuse expressions with offset

SCEVs ExprValueMap currently tracks not only which IR Values
correspond to a given SCEV expression, but additionally stores that
it may be expanded in the form X+Offset. In theory, this allows
reusing existing IR Values in more cases.

In practice, this doesn't seem to be particularly useful (the test
changes are rather underwhelming) and adds a good bit of complexity.
Per https://github.com/llvm/llvm-project/issues/53905, we have an
invalidation issue with these offseted expressions.

Differential Revision: https://reviews.llvm.org/D120311

show more ...


# 129af4da 17-Feb-2022 Arthur Eubanks <aeubanks@google.com>

[SCEVExpander][OpaquePtr] Check GEP source type when finding identical GEP

Fixes an opaque pointers miscompile.

Reviewed By: #opaque-pointers, nikic

Differential Revision: https://reviews.llvm.org

[SCEVExpander][OpaquePtr] Check GEP source type when finding identical GEP

Fixes an opaque pointers miscompile.

Reviewed By: #opaque-pointers, nikic

Differential Revision: https://reviews.llvm.org/D120004

show more ...


# d39f4ac4 09-Feb-2022 Philip Reames <listmail@philipreames.com>

[SCEV] Unwind SCEVUnionPredicate from getPredicatedBackedgeTakenCount [NFC]

For those curious, the whole reason for tracking the predicate set seperately as opposed to just immediately registering t

[SCEV] Unwind SCEVUnionPredicate from getPredicatedBackedgeTakenCount [NFC]

For those curious, the whole reason for tracking the predicate set seperately as opposed to just immediately registering the dependencies appears to be allowing the printing code to print a result without changing the PSE state. It's slightly questionable if this justifies the complexity, but since we can preserve it with local ugliness, I did so.

show more ...


Revision tags: llvmorg-14.0.0-rc1
# c302f1e6 08-Feb-2022 Philip Reames <listmail@philipreames.com>

[SCEV] Generalize SCEVEqualsPredicate to any compare [NFC]

PredicatedScalarEvolution has a predicate type for representing A == B. This change generalizes it into something which can represent a A

[SCEV] Generalize SCEVEqualsPredicate to any compare [NFC]

PredicatedScalarEvolution has a predicate type for representing A == B. This change generalizes it into something which can represent a A <pred> B.

This generality is currently unused, but is motivated by a couple of recent cases which have come up. In particular, I'm currently playing around with using this to simplify the runtime checking code in LoopVectorizer. Regardless of the outcome of that prototyping, generalizing the compare node seemed useful.

show more ...


# 2d650ee0 06-Feb-2022 Kazu Hirata <kazu@google.com>

[Transforms] Use default member initialization in SCEVFindUnsafe (NFC)


12345678