|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
935570b2 |
| 29-Jun-2022 |
Nikita Popov <[email protected]> |
[ConstExpr] Don't create div/rem expressions
This removes creation of udiv/sdiv/urem/srem constant expressions, in preparation for their removal. I've added a ConstantExpr::isDesirableBinOp() predic
[ConstExpr] Don't create div/rem expressions
This removes creation of udiv/sdiv/urem/srem constant expressions, in preparation for their removal. I've added a ConstantExpr::isDesirableBinOp() predicate to determine whether an expression should be created for a certain operator.
With this patch, div/rem expressions can still be created through explicit IR/bitcode, forbidding them entirely will be the next step.
Differential Revision: https://reviews.llvm.org/D128820
show more ...
|
|
Revision tags: llvmorg-14.0.6 |
|
| #
20b5f0c6 |
| 20-Jun-2022 |
Nikita Popov <[email protected]> |
[IR] Export ConstantFold.h header (NFC)
This is in preparation for https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179. As part of that change, we'll want to invoke some of these
[IR] Export ConstantFold.h header (NFC)
This is in preparation for https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179. As part of that change, we'll want to invoke some of these constant folding APIs explicitly, as it won't happen as part of ConstantExpr::getXYZ() anymore.
Ideally, we'd merge these with the DL-aware constant folding APIs and only call those, but this is not easily possible for some current usages (most important IRBuilder, which uses DL-independent constant folding by default, and some major layering changes would be needed to change that).
This is basically a reboot of D115035 with different motivation.
Differential Revision: https://reviews.llvm.org/D128213
show more ...
|
| #
0916d96d |
| 21-Jun-2022 |
Kazu Hirata <[email protected]> |
Don't use Optional::hasValue (NFC)
|
|
Revision tags: llvmorg-14.0.5, llvmorg-14.0.4 |
|
| #
08b20f20 |
| 05-May-2022 |
Benjamin Kramer <[email protected]> |
[ConstantFold] Use getFltSemantics instead of manually checking the type
Simplifies the code and makes fpext/fptrunc constant folding not crash when the result is bf16.
|
|
Revision tags: llvmorg-14.0.3, llvmorg-14.0.2 |
|
| #
ac8c720d |
| 16-Apr-2022 |
Craig Topper <[email protected]> |
[IR] Allow constant folding (insertelement <vscale x 2 x i32> zeroinitializer, i32 0, i32 i32 0.
Most of insertelement constant folding is blocked if the vector type is scalable. I believe we can ma
[IR] Allow constant folding (insertelement <vscale x 2 x i32> zeroinitializer, i32 0, i32 i32 0.
Most of insertelement constant folding is blocked if the vector type is scalable. I believe we can make an exception for inserting null into an all zeros vector.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123413
show more ...
|
|
Revision tags: llvmorg-14.0.1 |
|
| #
3c9f3f76 |
| 04-Apr-2022 |
Nikita Popov <[email protected]> |
[ConstantFold] Fold zero-index GEPs with opaque pointers
With opaque pointers, we can eliminate zero-index GEPs even if they have multiple indices, as this no longer impacts the result type of the G
[ConstantFold] Fold zero-index GEPs with opaque pointers
With opaque pointers, we can eliminate zero-index GEPs even if they have multiple indices, as this no longer impacts the result type of the GEP.
This optimization is already done for instructions in InstSimplify, but we were missing the corresponding constant expression handling.
The constexpr transform is a bit more powerful, because it can produce a vector splat constant and also handles undef values -- it is an extension of an existing single-index transform.
show more ...
|
|
Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4 |
|
| #
7781f61e |
| 11-Mar-2022 |
Nikita Popov <[email protected]> |
[ConstantFold] Fix scalable shufflevector fold with all-undef mask
If the input is scalable, we should not be returning a fixed-width vector as a result.
|
|
Revision tags: llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init |
|
| #
e188aae4 |
| 31-Jan-2022 |
serge-sans-paille <[email protected]> |
Cleanup header dependencies in LLVMCore
Based on the output of include-what-you-use.
This is a big chunk of changes. It is very likely to break downstream code unless they took a lot of care in avo
Cleanup header dependencies in LLVMCore
Based on the output of include-what-you-use.
This is a big chunk of changes. It is very likely to break downstream code unless they took a lot of care in avoiding hidden ehader dependencies, something the LLVM codebase doesn't do that well :-/
I've tried to summarize the biggest change below:
- llvm/include/llvm-c/Core.h: no longer includes llvm-c/ErrorHandling.h - llvm/IR/DIBuilder.h no longer includes llvm/IR/DebugInfo.h - llvm/IR/IRBuilder.h no longer includes llvm/IR/IntrinsicInst.h - llvm/IR/LLVMRemarkStreamer.h no longer includes llvm/Support/ToolOutputFile.h - llvm/IR/LegacyPassManager.h no longer include llvm/Pass.h - llvm/IR/Type.h no longer includes llvm/ADT/SmallPtrSet.h - llvm/IR/PassManager.h no longer includes llvm/Pass.h nor llvm/Support/Debug.h
And the usual count of preprocessed lines: $ clang++ -E -Iinclude -I../llvm/include ../llvm/lib/IR/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 6400831 after: 6189948
200k lines less to process is no that bad ;-)
Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D118652
show more ...
|
| #
0f0e6997 |
| 27-Jan-2022 |
Nikita Popov <[email protected]> |
[ConstantFold] Disable gep of array bitcast fold with opaque pointers
Once again, this fold is meaningless with opaque pointers, as there is no pointer element type to canonicalize. At some point, w
[ConstantFold] Disable gep of array bitcast fold with opaque pointers
Once again, this fold is meaningless with opaque pointers, as there is no pointer element type to canonicalize. At some point, we may want to do GEP type canonicalizations.
show more ...
|
| #
aa97bc11 |
| 21-Jan-2022 |
Nikita Popov <[email protected]> |
[NFC] Remove uses of PointerType::getElementType()
Instead use either Type::getPointerElementType() or Type::getNonOpaquePointerElementType().
This is part of D117885, in preparation for deprecatin
[NFC] Remove uses of PointerType::getElementType()
Instead use either Type::getPointerElementType() or Type::getNonOpaquePointerElementType().
This is part of D117885, in preparation for deprecating the API.
show more ...
|
|
Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2 |
|
| #
c41aa419 |
| 06-Jan-2022 |
Nikita Popov <[email protected]> |
[ConstFold] Add missing check for inbounds gep
If the gep is not inbounds, then the gep might compute a null value even if the base pointer is non-null.
|
| #
6c031780 |
| 04-Jan-2022 |
Nikita Popov <[email protected]> |
[ConstantFold] Remove another incorrect icmp of gep fold
This folded (null + X) == g to false, but of course this is incorrect if X == g.
Possibly this got confused with the null == g case, which i
[ConstantFold] Remove another incorrect icmp of gep fold
This folded (null + X) == g to false, but of course this is incorrect if X == g.
Possibly this got confused with the null == g case, which is already handled elsewhere.
show more ...
|
| #
d7421298 |
| 04-Jan-2022 |
Nikita Popov <[email protected]> |
[ConstantFold] Remove unnecessary bounded index restriction
The fold for merging a GEP of GEP into a single GEP currently bails if doing so would result in notional overindexing. The justification g
[ConstantFold] Remove unnecessary bounded index restriction
The fold for merging a GEP of GEP into a single GEP currently bails if doing so would result in notional overindexing. The justification given in the comment above this check is dangerously incorrect: GEPs with notional overindexing are perfectly fine, and if some code treats them incorrectly, then that code is broken, not the GEP. Such a GEP might legally appear in source IR, so only preventing its creation cannot be sufficient. (The constant folder also ends up canonicalizing the GEP to remove the notional overindexing, but that's neither here nor there.)
This check dates back to https://github.com/llvm/llvm-project/commit/bd4fef4a8939db18f39b108e19097b25e2c7c47a, and as far as I can tell the original issue this was trying to patch around has since been resolved.
Differential Revision: https://reviews.llvm.org/D116587
show more ...
|
| #
1379eb57 |
| 04-Jan-2022 |
Nikita Popov <[email protected]> |
[ConstFold] Slightly clean up icmp of two geps fold (NFC)
As we're only dealing with one type of constant expression here, try to directly cast to GEPOperator.
|
| #
75db0027 |
| 04-Jan-2022 |
Nikita Popov <[email protected]> |
[ConstantFold] Remove another incorrect icmp of GEP fold
This fold is not correct, because indices might evaluate to zero even if they are not a literal zero integer. Additionally, this fold would b
[ConstantFold] Remove another incorrect icmp of GEP fold
This fold is not correct, because indices might evaluate to zero even if they are not a literal zero integer. Additionally, this fold would be wrong (in the general case) for non-i8 types as well, due to index overflow.
Drop this fold and instead let the target-dependent constant folder compute the actual offset and fold the comparison based on that.
show more ...
|
| #
127d9554 |
| 03-Jan-2022 |
Nikita Popov <[email protected]> |
[ConstantFold] Drop unused function (NFC)
isMaybeZeroSizeType() is no longer used after 5afbfe33e7d6ce40af0ad6d99421b443c45b351b.
|
| #
5afbfe33 |
| 28-Dec-2021 |
Nikita Popov <[email protected]> |
[ConstantFold] Make icmp of gep fold offset based
We can fold an equality or unsigned icmp between base+offset1 and base+offset2 with inbounds offsets by comparing the offsets directly.
This replac
[ConstantFold] Make icmp of gep fold offset based
We can fold an equality or unsigned icmp between base+offset1 and base+offset2 with inbounds offsets by comparing the offsets directly.
This replaces a pair of specialized folds that tried to reason based on the GEP structure instead. One of those folds was plain wrong (because it does not account for negative offsets), while the other is unnecessarily complicated and limited (e.g. it will fail with bitcasts involved).
The disadvantage of this change is that it requires data layout, so the fold is no longer performed by datalayout-independent constant folding. I don't think this is a loss in practice, but it does regress the ConstantExprFold.ll test, which checks folding without running any passes.
Differential Revision: https://reviews.llvm.org/D116332
show more ...
|
| #
ecfd9196 |
| 29-Dec-2021 |
Serge Pavlov <[email protected]> |
[ConstantFolding] Use ICmpInst::Predicate instead of plain integer
The function `ConstantFoldCompareInstruction` uses `unsigned short` to represent compare predicate, although all usesrs of the resp
[ConstantFolding] Use ICmpInst::Predicate instead of plain integer
The function `ConstantFoldCompareInstruction` uses `unsigned short` to represent compare predicate, although all usesrs of the respective include file use definition of CmpInst also. This change replaces predicate argument type in this function to `ICmpInst::Predicate`, which allows to make code a bit clearer and simpler.
No functional changes.
Differential Revision: https://reviews.llvm.org/D116379
show more ...
|
| #
23de66d1 |
| 28-Dec-2021 |
Nikita Popov <[email protected]> |
[ConstFold] Don't fold signed comparison of gep of global
An inbounds GEP may still cross the sign boundary, so signed icmps cannot be folded (https://alive2.llvm.org/ce/z/XSgi4D). This was previous
[ConstFold] Don't fold signed comparison of gep of global
An inbounds GEP may still cross the sign boundary, so signed icmps cannot be folded (https://alive2.llvm.org/ce/z/XSgi4D). This was previously fixed for other folds in this function, but this one was missed.
show more ...
|
|
Revision tags: llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4 |
|
| #
d86e2cc2 |
| 19-Sep-2021 |
Serge Pavlov <[email protected]> |
[NFC] Method for evaluation of FCmpInst for constant operands
New method `FCmpInst::compare` is added, which evaluates the given compare predicate for constant operands. Interface is made similar to
[NFC] Method for evaluation of FCmpInst for constant operands
New method `FCmpInst::compare` is added, which evaluates the given compare predicate for constant operands. Interface is made similar to `ICmpInst::compare`.
Differential Revision: https://reviews.llvm.org/D116168
show more ...
|
| #
c23ebf17 |
| 09-Dec-2021 |
Kazu Hirata <[email protected]> |
[llvm] Use range-based for loops (NFC)
|
| #
2a48b699 |
| 08-Nov-2021 |
David Sherwood <[email protected]> |
[IR] In ConstantFoldShuffleVectorInstruction use zeroinitializer for splats of 0
When creating a splat of 0 for scalable vectors we tend to create them with using a combination of shufflevector and
[IR] In ConstantFoldShuffleVectorInstruction use zeroinitializer for splats of 0
When creating a splat of 0 for scalable vectors we tend to create them with using a combination of shufflevector and insertelement, i.e.
shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 0, i32 0), <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer)
However, for the case of a zero splat we can actually just replace the above with zeroinitializer instead. This makes the IR a lot simpler and easier to read. I have changed ConstantFoldShuffleVectorInstruction to use zeroinitializer when creating a splat of integer 0 or FP +0.0 values.
Differential Revision: https://reviews.llvm.org/D113394
show more ...
|
| #
25043c82 |
| 30-Oct-2021 |
Roman Lebedev <[email protected]> |
[NFCI] Introduce `ICmpInst::compare()` and use it where appropriate
As noted in https://reviews.llvm.org/D90924#inline-1076197 apparently this is a pretty common pattern, let's not repeat it yet aga
[NFCI] Introduce `ICmpInst::compare()` and use it where appropriate
As noted in https://reviews.llvm.org/D90924#inline-1076197 apparently this is a pretty common pattern, let's not repeat it yet again, but have it in a common place.
There may be some more places where it could be used, but these are the most obvious ones.
show more ...
|
| #
a9bceb2b |
| 30-Sep-2021 |
Jay Foad <[email protected]> |
[APInt] Stop using soft-deprecated constructors and methods in llvm. NFC.
Stop using APInt constructors and methods that were soft-deprecated in D109483. This fixes all the uses I found in llvm, exc
[APInt] Stop using soft-deprecated constructors and methods in llvm. NFC.
Stop using APInt constructors and methods that were soft-deprecated in D109483. This fixes all the uses I found in llvm, except for the APInt unit tests which should still test the deprecated methods.
Differential Revision: https://reviews.llvm.org/D110807
show more ...
|
| #
bdee805b |
| 24-Sep-2021 |
Simon Pilgrim <[email protected]> |
[ConstantFold] ConstantFoldGetElementPtr - use APInt::isNegative() instead of getSExtValue() to support big ints
Fixes fuzz test: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=39197
|