https://github.com/JuliaLang/julia

sort by:
Revision Author Date Message Commit Date
1b4bfa2 WIP 04 October 2023, 16:07:06 UTC
3814801 nothrow try/catch opt 03 October 2023, 19:33:24 UTC
59f805f Actually delete :enter blocks known dead 03 October 2023, 19:27:48 UTC
8cdff94 lowering: Keep track of which :enter correspond to which :leave This should be NFC and is intended to allow the optimizer to delete :enter statements (by replacing them with `nothing`), without leaving dangling `:leave`s around. This is accomplished by having `leave` take (a variable number of) `:enter` tokens (that are already being used by `:pop_exception`). The semantics are that a literal `nothing` or an SSAValue pointing to a `nothing` statement are ignored, and one exception handler is popped for each remaining argument. The actual value of the token is ignored, except that the verifier asserts that it belongs to an `:enter`. Note that we don't need to do the same for :pop_exception, because the token generated by an `:enter` is semantically only in scope for :pop_exception during its catch block. If we determine the `:enter` is dead, then its catch block is guaranteed to not be executed and will be deleted wholesale by cfg liveness. I was considering doing something fancier where :leave is changed back to taking an integer after optimization, but the case where the IR size is bigger after this change (when we are `:leave`ing many handlers) is fairly rare and likely not worth the additional complexity or time cost to do anything special. If it does show up in size benchmarks, I'd rather give `:leave` a special, compact encoding. 03 October 2023, 19:26:37 UTC
ab08f1d Don't visit the return block for empty try/catch 03 October 2023, 19:26:27 UTC
311bc60 WIP: Add explicitly wrapping versions of integer arithmetic 29 July 2023, 21:53:46 UTC
210c5b5 Fix rdiv of complex lhs by real factorizations (#50671) Co-authored-by: Martin Holters <martin@holters.name> 29 July 2023, 16:59:04 UTC
c664a57 Fix link in TOML docs (#50715) 29 July 2023, 16:54:58 UTC
5c69561 Attach `tanpi` docstring to method (#50689) 29 July 2023, 16:39:50 UTC
4825a0c A legendary tale of why we should make pmap default to using CachingPool (#33892) Once upon a time, there was a young julia user first getting started with parallelism. And she found it fearsomely slow. And so she did investigate, and she did illuminate upon her issue. Her closures, they were being reserialized again and again. And so this young woman, she openned an issue #16345. Lo and behold, a noble soul did come and resolve it, by making the glorious `CachingPool()` in #16808. 3 long years a later this julia user did bravely return to the world of parallism, with many battle worn scars. and once more she did face the demon that is `pmap` over closures. But to her folly, she felt no fear, for she believed the demon to be crippled and chained by the glorious `CachingPool`. Fearlessly, she threw his closure over 2GB of data into the maw of the demon `pmap`. But alas, alas indeed, she was wrong. The demon remained unbound, and it slew her, and slew her again. 100 times did it slay her for 101 items was the user iterating upon. For the glorious chains of the the `CachingPool()` remains unused, left aside in the users tool chest, forgotten. 28 July 2023, 23:57:12 UTC
503d5b4 Revert "Remove number / vector (#44358)" (#49915) 28 July 2023, 21:25:23 UTC
62605cc include `--pkgimage=no` caches for stdlibs (#50666) 27 July 2023, 17:35:04 UTC
943db02 Restructure JIT to have more extension points and more logical control flow (#50650) Rather than forking the optimize and compile layers into individual layers per optlevel, each optimize and compile layer will switch on the requested optlevel of the module, which reduces the complexity of tracing a module's path through the JIT. In addition, this lets us move some of the `addModule` code to happen post-optimization, which makes the optimization pipeline not see literal pointers except those generated by codegen. 27 July 2023, 15:17:04 UTC
da19bc1 document Libc.FILE (#49908) Adds some missing documentation for `Libc.FILE`, which is already exported. 27 July 2023, 15:10:00 UTC
dc06468 Make reinterpret specialize fully. (#50670) Fixes https://github.com/JuliaLang/julia/issues/50612 The issue here was the reinterpret change made a bunch of operations like `Core.bitcast(UInt64,24)` not fold, even though they are fully known at compile time. That made `UInt32(Char)` not inline which then caused the regression. 27 July 2023, 11:09:58 UTC
4fd68e8 Add `Libdl.LazyLibrary` (#50074) This provides an in-base mechanism to handle chained library dependencies. In essence, the `LazyLibrary` object can be used anywhere a pointer to a library can be used (`dlopen`, `dlsym`, `ccall`, etc...) but it delays loading the library (and its recursive dependencies) until it is actually needed. This is the foundational piece needed to upgrade JLLs to lazily-load their libraries. In this new scheme, JLLs would generally lose all executable code and consist of nothing more than `LazyLibrary` definitions. 27 July 2023, 11:07:56 UTC
43a14f8 Base.MPFR: implement `signbit` in Julia without a `ccall` (#50675) This accesses MPFR's internals, but it should be stable. 27 July 2023, 00:57:10 UTC
4cdd8cd Properly isolate `sysimg` bootstrap environment (#50683) The stdlib environment should be isolated from the global environment while it is bootstrapping; it should only load from the stdlib directory. 26 July 2023, 23:36:13 UTC
c43e5a1 `versioninfo()`: include build info and unofficial warning (#50635) 26 July 2023, 19:40:55 UTC
ff14eaf Reuse incremental JIT compilation for --image-codegen (#50649) We don't need to merge all of the workqueue modules when performing compilation with `--image-codegen` set, we just need the global variable initializers to be defined before they're used in one of the modules. Therefore we can do this by compiling all of the global variable initializers upfront, so that later references will link them properly. 26 July 2023, 13:34:54 UTC
8c3452f Clean up various naming aspects of codegen (#50638) Most of the changes are changing from `const std::string &` to `const Twine &`, which lets us be lazier about computing string values efficiently. We also make the plt function private linkage since it's only referred to by the plt global. --------- Co-authored-by: Jameson Nash <vtjnash@gmail.com> 26 July 2023, 13:32:34 UTC
9c6efd6 remove extraneous using .Libdl in Libc (#50672) From f9351253124 --------- Co-authored-by: Elliot Saba <staticfloat@gmail.com> 26 July 2023, 12:46:37 UTC
c777c71 fix hashing regression. (#50655) This fixes 2 bugs introduced by #49996 and #50041. Closes #50628. 26 July 2023, 10:21:19 UTC
a87b164 fix 32 bit tests 26 July 2023, 01:48:37 UTC
7ca0f0d codegen: Remove literal_static_pointer_val from literal_pointer_val implementation (#50632) This eliminates most of the literal pointers outside of ccalls and directly JIT-ted code, except instead of adding names we instead just use imaging mode and fix up the visualization in `jl_get_llvmf_defn`. 25 July 2023, 19:54:44 UTC
207c09a Avoid generic call in most cases for getproperty (#50523) More generic than https://github.com/JuliaLang/julia/pull/50444. Should we keep the boundscheck on the getfield since we got the index from the runtime itself? 25 July 2023, 19:31:27 UTC
9124234 print `@time` msg into print buffer (#50665) 25 July 2023, 15:59:28 UTC
6f6439e Don't use integer division for cong (#50427) 24 July 2023, 20:04:20 UTC
c57d33a Remove SparseArrays legacy code (#50637) 24 July 2023, 17:22:47 UTC
1f2b5e0 Update base/float.jl Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com> 24 July 2023, 16:07:38 UTC
3cc0590 `Array(::AbstractRange)` should return an `Array` (#50568) Currently, `Array(r::AbstractRange)` falls back to `vcat(r)`, but certain ranges may choose to specialize `vcat(r::AbstractRange)` to not return an `Array`. This PR ensures that `Array(r)` always returns an `Array`. At present, there's some code overlap with `vcat` (just above the `Array` method added in this PR). Perhaps some of these may be replaced by `unsafe_copyto!`, but the tests for ranges include some special cases that don't support `getindex`, which complicates things a bit. I've not done this for now. In any case, the common bit of code is pretty simple, so perhaps the duplication is harmless. 24 July 2023, 16:03:22 UTC
0fcac7a Update base/float.jl Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com> 24 July 2023, 15:47:20 UTC
08fdf0a Update base/float.jl Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com> 24 July 2023, 15:43:13 UTC
eaffc71 Update base/float.jl Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com> 24 July 2023, 15:43:06 UTC
760c8be typo 24 July 2023, 15:40:39 UTC
0d4b2a1 add comments 24 July 2023, 15:13:33 UTC
02a158f fix hashing 24 July 2023, 14:55:03 UTC
76a9772 add `using Random` to UUIDs docstring (#50622) this makes the docstring more self-contained 24 July 2023, 14:29:32 UTC
19f6926 [NFC] minor refactorings on gf.c & codegen.cpp (#50645) Improvements I made during I looked at the execution chain of top-level code. 24 July 2023, 13:32:51 UTC
e23e116 Shift DCE pass to optimize imaging mode code better (#50631) 23 July 2023, 17:27:17 UTC
ae798cd Revert storage of method instance in LineInfoNode (#50546) Due to #50082, reverting the causative portion from #41099, which stored MethodInstances in LineInfoNodes. 23 July 2023, 14:39:55 UTC
3c5b3c0 Add `Base.format_bytes(; binary=false)` option (#50572) Add a `binary` keyword argument to `Base.format_bytes` that enables switching between the default units KiB, MiB, GiB, etc. and kB, MB, GB. I've wanted this feature multiple times before so I thought I should just make a PR. ```julia julia> Base.format_bytes(12345678) "11.774 MiB" julia> Base.format_bytes(12345678; binary=false) # with this PR "12.346 MB" ``` 23 July 2023, 14:38:09 UTC
3d944dd Add function signature to code_native and code_llvm (#50630) When getting LLVM IR from `@code_llvm`, it's sometimes necessary to know exactly which `f` is being compiled. This prints the type signature of a function in front of `code_llvm` and `code_native` to assist in that process. <details> <summary>Example</summary> ```julia julia> @code_llvm zeros(64) ``` ```llvm ; Function Signature: zeros(Int64) ; @ array.jl:629 within `zeros` define nonnull {}* @julia_zeros_121(i64 signext %"dims[1]::Int64") #0 { top: ; @ array.jl:629 within `zeros` @ array.jl:631 @ array.jl:634 ; ┌ @ boot.jl:484 within `Array` @ boot.jl:475 %0 = call nonnull {}* inttoptr (i64 140604991500960 to {}* ({}*, i64)*)({}* inttoptr (i64 140604630439728 to {}*), i64 %"dims[1]::Int64") ; └ ; @ array.jl:629 within `zeros` @ array.jl:631 @ array.jl:635 ; ┌ @ array.jl:392 within `fill!` ; │┌ @ abstractarray.jl:318 within `eachindex` ; ││┌ @ abstractarray.jl:134 within `axes1` ; │││┌ @ abstractarray.jl:98 within `axes` ; ││││┌ @ array.jl:191 within `size` %1 = bitcast {}* %0 to { i8*, i64, i16, i16, i32 }* %.length_ptr = getelementptr inbounds { i8*, i64, i16, i16, i32 }, { i8*, i64, i16, i16, i32 }* %1, i64 0, i32 1 %.length = load i64, i64* %.length_ptr, align 8 ; │└└└└ ; │┌ @ range.jl:897 within `iterate` ; ││┌ @ range.jl:674 within `isempty` ; │││┌ @ operators.jl:378 within `>` ; ││││┌ @ int.jl:83 within `<` %.not.not = icmp eq i64 %.length, 0 ; │└└└└ br i1 %.not.not, label %L30, label %L13.preheader L13.preheader: ; preds = %top %2 = bitcast {}* %0 to i8** %.data1013 = load i8*, i8** %2, align 8 ; │ @ array.jl:394 within `fill!` %3 = shl nuw i64 %.length, 3 ; │ @ array.jl:393 within `fill!` ; │┌ @ array.jl:1019 within `setindex!` call void @llvm.memset.p0i8.i64(i8* nonnull align 8 %.data1013, i8 0, i64 %3, i1 false) ; └└ ; @ array.jl:629 within `zeros` br label %L30 L30: ; preds = %L13.preheader, %top ret {}* %0 } ``` </details> 23 July 2023, 14:37:12 UTC
092231c Backport LLVM patches to fix various issues. (#50639) - https://github.com/llvm/llvm-project/commit/af39acda8873cc75db116e326588447f018a99d9 closing https://github.com/JuliaLang/julia/issues/50448 - https://reviews.llvm.org/D139078 closing https://github.com/JuliaLang/julia/issues/49907 23 July 2023, 14:28:29 UTC
32aa29f Page based heap size heuristics (#50144) This PR implements GC heuristics based on the amount of pages allocated instead of live objects like was done before. The heuristic for new heap target is based on https://dl.acm.org/doi/10.1145/3563323 (in summary it argues that the heap target should have square root behaviour). From my testing this fixes https://github.com/JuliaLang/julia/issues/49545 and https://github.com/JuliaLang/julia/issues/49761 23 July 2023, 13:11:50 UTC
d1be33d Assert tid>0 in workqueue_for (#50602) Otherwise the inbounds annotations are not sound. As requested in https://github.com/JuliaLang/julia/pull/50597#pullrequestreview-1537852869. 22 July 2023, 20:20:48 UTC
6691a75 🤖 [master] Bump the SparseArrays stdlib from b4b0e72 to 99c99b4 (#50634) Stdlib: SparseArrays URL: https://github.com/JuliaSparse/SparseArrays.jl.git Stdlib branch: main Julia branch: master Old commit: b4b0e72 New commit: 99c99b4 Julia version: 1.11.0-DEV SparseArrays version: 1.10.0 (Does not match) Bump invoked by: @dkarrasch Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: https://github.com/JuliaSparse/SparseArrays.jl/compare/b4b0e721ada6e8cf5f6391aff4db307be69b0401...99c99b4521eb19a7973643d1aa4d7b1e4d50a6db ``` $ git log --oneline b4b0e72..99c99b4 99c99b4 Specialize 3-arg `dot` for sparse self-adjoint matrices (#398) cb10c1e use unwrapping mechanism for triangular matrices (#396) b3872c8 added warning for iterating while mutating a sparse matrix (#415) f8f0f40 bring coverage of fixed SparseMatrixCSC to 100% (#392) 0eb9c04 fix typos (#414) ``` Co-authored-by: Dilum Aluthge <dilum@aluthge.com> 22 July 2023, 15:53:24 UTC
c82656d gc: faster invalid object lookup in conservative GC (#50599) Optimizes invalid object lookup in conservative GC by just looking at the page metadata and GC bits. 22 July 2023, 00:55:32 UTC
90c0e19 Add function signature to code_native and code_llvm 22 July 2023, 00:02:56 UTC
bf00ff4 Add extra profiling events to JIT/AOT compilation (#50610) 21 July 2023, 19:34:42 UTC
049de79 Name a couple more things in LLVM IR (#50625) 21 July 2023, 19:33:09 UTC
958f647 Remove libuv_jll contents (#50601) We link libuv statically, so there's no point in trying to use a JLL. I'm not removing the JLL entirely as removing stdlibs is difficult, and we may link libuv dynamically in the future. Fixes https://github.com/JuliaLang/julia/issues/50592 21 July 2023, 03:21:21 UTC
eb74011 Update runtests.jl 20 July 2023, 23:20:53 UTC
d080fe6 build: fix various makefile bugs (#50591) Trying for cross-compile and disabling CSL and realized both of those configurations were broken now. 20 July 2023, 19:57:46 UTC
9f3ca7c Merge branch 'master' into new-heuristics 20 July 2023, 17:08:25 UTC
51941ed Add missing root for method instances used in opaque closure (#50359) Usually the rooting path for method instances is something like this: Module -> DataType -> TypeName -> MethodTable -> Method -> MethodInstance so these MethodInstances are effectively globally rooted. However, the Method(instances) inside opaque closures do not have this rooting path and can be deleted. Unfortunately, if we codegen'ed these opaque closures, we do have a reference to the method instance in our global debuginfo tables. This was causing crashes in cases where the oc was gc'ed before a stack trace could be printed. Fix that by adding any method instance that needs to be rooted to the global roots table. Reported by @staticfloat 20 July 2023, 13:08:32 UTC
4461d77 Improve error message for clangsa safepoint error 19 July 2023, 21:28:23 UTC
58fb3ad Add missing root for method instances used in opaque closure Usually the rooting path for method instances is something like this: Module -> DataType -> TypeName -> MethodTable -> Method -> MethodInstance so these MethodInstances are effectively globally rooted. However, the Method(instances) inside opaque closures do not have this rooting path and can be deleted. Unfortunately, if we codegen'ed these opaque closures, we do have a reference to the method instance in our global debuginfo tables. This was causing crashes in cases where the oc was gc'ed before a stack trace could be printed. Fix that by adding any method instance that needs to be rooted to the global roots table. 19 July 2023, 21:28:23 UTC
bd8350b Fix memory corruption if task is launched inside finalizer (#50597) In #48919, the tid selection logic inside `enq_task` gained a `!GC.in_finalizer()` condition. However, this made it possible for `workqueue_at` to be reached with `tid==0`, which would attempt and out-of-bounds write under `@inbounds`, corrupting memory. This was not caught in the test suite despite `--check-bounds=yes`, because our `--check-bounds=yes` is currently best effort. That would be fixed by #50239, which exposed this bug. This PR attempts to fix this by marking any tasks launched inside a finalizer as not sticky. Finalizers don't have any thread they run on semantically, so i don't think there's a meaningful sense in which tasks launched inside finalizers could be sticky. 19 July 2023, 19:36:59 UTC
077efd4 Rename ENV variable `JULIA_USE_NEW_PARSER` -> `JULIA_USE_FLISP_PARSER` (#50595) Closes #50470 19 July 2023, 19:19:10 UTC
3d94a30 Remove libuv_jll contents We link libuv statically, so there's no point in trying to use a JLL. I'm not removing the JLL entirely as removing stdlibs is difficult, and we may link libuv dynamically in the future. 19 July 2023, 19:07:36 UTC
d256f92 Fix visibility of assert on GCC12/13 (#50516) 19 July 2023, 18:31:21 UTC
de2c37a gf: make method overwrite/delete an error during precompile (#50578) Previously, this was only a WARNING message, which was often missed during CI runs. Closes https://github.com/JuliaLang/julia/issues/50451 19 July 2023, 17:48:18 UTC
bd8734f Add `--compiled-modules=existing` command line option (#50586) Occasionally when developing new compiler features, it is not possible for me to precompile the package I'm developing (because it relies on the new compiler features, which are only available if Revise'd in). `--compiled-modules=no` is an option, but for packages with deep dependency stacks, this is not practical (in addition to slowing down use of development utilities like Revise, Cthulhu or Plots). Originally I tried to add a mode to `--compiled-modules` that would avoid using compiled modules for anything that's dev'ed, but that's a pretty complicated thing to figure out in the loading code, because you could have a non-`dev`'ed package that depends on a `dev`'ed package and you'd want to avoid loading that as well, but we don't technically have explicit dependency links at the loading level. This sidesteps all that and just adds a simpler option: `existing`. This option simply uses any pre-existing cache files if they exist, but refuses to create new ones. This does effectively the same thing, because the only packages with stale cache files are usually the ones that I've edited. However, the semantics are much simpler for loading to implement. 19 July 2023, 17:40:32 UTC
1116d7c rename env var JULIA_USE_NEW_PARSER -> JULIA_USE_FLISP_PARSER 19 July 2023, 10:06:55 UTC
0f56da8 inlining: NFC simplifications on the inlining algorithm (#50593) - pack return value of `ir_prepare_inlining!` into a struct and pass it around - improved handling of `linetable` argument 19 July 2023, 09:09:04 UTC
c5e4621 inference: refine `PartialStruct` with declared method signature (#50590) At present, in very rare cases, `PartialStruct` used for const-prop' might have type information that's less strict than type information that can be derived from the method's type signature, e.g.: ```julia Base.@constprop :aggressive function refine_partial_struct((a, b)::Tuple{String,Int}) if iszero(b) println("b=0") # to prevent semi-concrete eval return nothing else return a end end @test Base.return_types((AbstractString,)) do s refine_partial_struct((s, 42)) end |> only === String ``` This commit enhances the accuracy of const-prop' by propagating `tmeet` of `PartialStruct` and the declared type in such situations. 19 July 2023, 05:01:21 UTC
15b34a5 Add under pressure callback 19 July 2023, 01:11:18 UTC
0bf560a NFC changes on base/compiler/inferenceresult.jl (#50589) - specialize `va_hanlder!` - tidy up the implementation of `cache_lookup` @nanosoldier `runbenchmarks("inference", vs=":master")` 19 July 2023, 00:56:08 UTC
7288095 Require -g2 for llvm names, set code_llvm to -g2 (#50585) 18 July 2023, 22:06:42 UTC
b3f766c lowering: Disallow splatting in non-final default value (#50563) Pop quiz: Do you know what the following will do? ``` julia> function g1(a=(1,2)..., b...=3) b end julia> g1() julia> function g2(a=(1,2)..., b=3, c=4) (b, c) end julia> g2() julia> function g3(a=(1,2)..., b=3, c...=4) (b, c) end julia> g3() julia> g3(1) ``` I don't either and I don't think it's particularly well defined. Splatting a default argument makes sense on the last argument, which can be a vararg, and it is desirable to be able to specify the default for the whole varargs tuple at once (although arguably that should just be the non-`...` behavior, but that'd be too breaking a change). Ref #50518. However, for other arguments, there isn't really a sensible semantic meaning. This PR disallows this in lowering. This is technically a minor change, but I doubt anybody is using this. Splatting in default values wasn't really ever supposed to work anyway, it just happened to fall out of our lowering. --------- Co-authored-by: Jeff Bezanson <jeff.bezanson@gmail.com> 18 July 2023, 21:40:21 UTC
d270a71 isassigned for ranges with BigInt indices (#50587) This fixes certain possible regressions in `isassigned` for ranges to restore the 1.9-like behavior. On v1.9 ```julia julia> r = 1:big(2)^65 1:36893488147419103232 julia> isassigned(r, lastindex(r)) true julia> isassigned(r, true) ERROR: ArgumentError: invalid index: true of type Bool ``` On v1.10.0-alpha1 ```julia julia> isassigned(r, lastindex(r)) ERROR: InexactError: Int64(36893488147419103232) julia> isassigned(r, true) # Bool is converted to Int true julia> r[true] # but indexing with Bool doesn't work ERROR: ArgumentError: invalid index: true of type Bool ``` This PR ```julia julia> isassigned(r, lastindex(r)) true julia> isassigned(r, true) ERROR: ArgumentError: invalid index: true of type Bool ``` This still leaves ```julia julia> isassigned(collect(1:3), true) true ``` so that should perhaps be changed as well. 18 July 2023, 19:54:51 UTC
9dc1380 build: fix various makefile bugs Trying for cross-compile and disabling CSL and realized both of those configurations were broken now. 18 July 2023, 19:29:48 UTC
2cee483 use atomic compare exchange when setting the GC mark-bit (#50576) Fixes https://github.com/JuliaLang/julia/issues/50574. 18 July 2023, 03:32:56 UTC
7b40a36 minor `Core.Compiler` code quality improvements (#50569) 18 July 2023, 02:57:38 UTC
34ba62f Fix off-by-one in generator nospecialize (#50571) I had an off-by-one in #50556, since the argument slots actually start at 2 and `iota` starts at `0`. This was breaking StaticArrays precompiles, which attempts to precompile a generator with its abstract signature and without the nospecialize, those signatures are not compileable. Co-authored-by: Oscar Smith <oscardssmith@gmail.com> 18 July 2023, 02:57:09 UTC
c0d5352 Add more names to the generated LLVM IR (#50557) 18 July 2023, 01:51:28 UTC
f19c9cf Add getfield/setfield names, propagate names through more places (#50565) This makes field names show up when we lower setfield/getfield, and tries to ensure that names are propagated through operations. 17 July 2023, 23:50:23 UTC
e6a18f3 Experiment with not setting a max size by default at all 17 July 2023, 21:42:15 UTC
5eddb81 Improve "too many parameters" error (#50539) I'm still not satisfied with this but ```julia ERROR: too many parameters for type AbstractTriangular Stacktrace: [1] top-level scope @ REPL[3]:1 ``` is slightly better than ```julia ERROR: too many parameters for type Stacktrace: [1] top-level scope @ REPL[3]:1 ``` 17 July 2023, 18:58:35 UTC
3a9345c precompile: ensure globals are not accidentally created where disallowed (#50541) Usually this is caught by use of `eval`, but we should try to move away from that broad rule to specific functions such as this one, such that eventually we can remove that rule from `eval`. Fix #50538 17 July 2023, 18:54:17 UTC
f74bde8 add Base.format_bytes(; binary=false) option 17 July 2023, 16:37:40 UTC
ffe1a07 read(io, Char): fix read with too many leading ones (#50552) Fixes #50532. The `read(io, Char)` method didn't correctly handle the case where the lead byte starts with too many leading ones; this fix makes it handle that case correctly, which makes `read(io, Char)` match `collect(s)` in its interpretation of what a character is in all invalid cases. Also fix and test `read(::File, Char)` which has the same bug. 17 July 2023, 14:16:00 UTC
7141e73 Print LLVM module when verification fails (#50566) 17 July 2023, 13:48:58 UTC
df3fcb0 Merge branch 'master' into new-heuristics 17 July 2023, 13:44:49 UTC
1964621 remove `:boundscheck` argument from `Core._svec_ref` (#50561) `Core._svec_ref` has accepted `boundscheck`-value as the first argument since it was added in #45062. Nonetheless, `Core._svec_ref` simply calls `jl_svec_ref` in either the interpreter or the codegen, and thus the `boundscheck` value isn't utilized in any optimizations. Rather, even worse, this `boundscheck`-argument negatively influences the effect analysis (xref #50167 for details) and has caused type inference regressions as reported in #50544. For these reasons, this commit simply eliminates the `boundscheck` argument from `Core._svec_ref`. Consequently, `getindex(::SimpleVector, ::Int)` is now being concrete-eval eligible. closes #50544 17 July 2023, 03:46:58 UTC
024edd6 Add proper error for attempted use of undef slot (#50556) Fixes the segfault in #50518 and turns it into a proper error at both the syntax level (to catch lowering generating bad slot references) as well as at the codegen level (to catch e.g. bad generated functions and opaque closures). However, note that the latter case is technically undefined behavior, because we do not model the possibility that an otherwise-defined argument could throw at access time. Of course, throwing an error is allowable as undefined behavior and preferable to a segfault. 16 July 2023, 16:31:25 UTC
c22b1c1 typeintersect: also record chained `innervars` (#50551) On master, we only record direct `innervars` (`T` -> `S<:Val{T}`). And chained `innervars` might be ignored (`T` -> `S<:Val{V<:T}`. Before https://github.com/JuliaLang/julia/pull/48228, those chained `innervars` would have been wrapped into an `UnionAll`, thus we just need to check outer vars' lb/ub. Test added. ~Note: this only fix https://github.com/JuliaLang/julia/issues/50456#issuecomment-1632611284, the other MWE still get stackoverflow.~ 16 July 2023, 12:05:45 UTC
18d18dc Add unwrapping mechanism for triangular mul and solves (#50058) This adds an unwrapping mechanism to triangular matrices, basically following the BLAS example in terms of characters encoding wrappers. It mirrors the `AdjOrTransOrHermOrSym` mechanism closely. Packages that want to overload by storage type can overload `generic_trimatmul!` (and potentially `generic_matrimul!`). Note the similarity to `generic_matvecmul!` and `generic_matmatmul!`. There is, unfortunately, some added code due to the fact that lazy conjugate wrappers have a different "wrapper depth" compared to the classic, e.g., `*Triangular{<:Any,<:Adjoint}`. I believe that with this PR we cover all wrappers of typically dense matrices with the unwrapping mechanism. ~~An analogous approach could be applied to `ldiv!`, if that's of interest and of benefit to the ecosystem.~~ 16 July 2023, 10:04:41 UTC
e67ddaa Add unwrapping mechanism for triangular matrices 16 July 2023, 07:30:51 UTC
38ae975 Merge branch 'master' into kf/unusederror 15 July 2023, 17:02:29 UTC
d215d91 Expand kwcall lowering positional default check to vararg (#50559) Fixes the case from #50518, but we actually have two test cases in the tests that also hit this (e.g. this one: ``` f40964(xs::Int...=1; k = 2) = (xs, k) ``` ), but just happened not to hit the bad codegen path. #50556, once merged would have complained on those definitions as well, without this fix. 15 July 2023, 17:01:26 UTC
191256e Assume size is non-negative for increased efficiency (#50530) I noticed [here](https://github.com/JuliaLang/julia/pull/50467#discussion_r1260299610) that `lastindex(x::Base.OneTo)` is not simply `x.stop`. This PR performs that optimization and many more by assuming `size` always returns positive numbers. ``` julia> @code_native lastindex(Base.OneTo(5)) # master .section __TEXT,__text,regular,pure_instructions .build_version macos, 13, 0 .globl _julia_lastindex_81 ; -- Begin function julia_lastindex_81 .p2align 2 _julia_lastindex_81: ; @julia_lastindex_81 ; ┌ @ abstractarray.jl:423 within `lastindex` ; %bb.0: ; %top ; │┌ @ abstractarray.jl:386 within `eachindex` ; ││┌ @ abstractarray.jl:134 within `axes1` ; │││┌ @ range.jl:708 within `axes` ; ││││┌ @ range.jl:471 within `oneto` ; │││││┌ @ range.jl:469 within `OneTo` @ range.jl:454 ; ││││││┌ @ promotion.jl:532 within `max` ; │││││││┌ @ int.jl:83 within `<` ldr x8, [x0] ; │││││││└ ; │││││││┌ @ essentials.jl:642 within `ifelse` cmp x8, #0 csel x0, x8, xzr, gt ; │└└└└└└└ ret ; └ ; -- End function .subsections_via_symbols julia> @code_native lastindex(Base.OneTo(5)) # pr .section __TEXT,__text,regular,pure_instructions .build_version macos, 13, 0 .globl _julia_lastindex_13253 ; -- Begin function julia_lastindex_13253 .p2align 2 _julia_lastindex_13253: ; @julia_lastindex_13253 ; ┌ @ abstractarray.jl:423 within `lastindex` ; %bb.0: ; %top ldr x0, [x0] ret ; └ ; -- End function .subsections_via_symbols ``` Also removed `axes(r::AbstractRange) = (oneto(length(r)),)` (added in #40382, @vtjnash) as redundant with the general `axes` method. The obvious downside here is that if someone defines an object with negative size, its axes will include Base.OneTo with negative stop. I think that is acceptable, but if not, we can gate this optimization to a set of known types (all AbstractArray types defined in Base should have non-negative size) 15 July 2023, 17:00:05 UTC
99e2604 sroa: Fix accidentally dropped condition (#50555) Fixes the issue noted in [1] (#50522) and adds a test to make sure that it doesn't regress. [1] https://github.com/JuliaLang/julia/commit/9b73611072b32b40c0d3abe14700515380c26848#r121641452 15 July 2023, 15:46:07 UTC
7735556 Name LLVM function arguments (#50500) This makes it easier to correlate LLVM IR with the originating source code by including both argument name and argument type in the LLVM argument variable. <details> <summary>Example 1</summary> ```julia julia> function f(a, b, c, d, g...) e = a + b + c + d f = does_not_exist(e) + e f end f (generic function with 1 method) julia> @code_llvm f(0,0,0,0,0) ``` ```llvm ; @ REPL[1]:1 within `f` define nonnull {}* @julia_f_141(i64 signext %"a::Int64", i64 signext %"b::Int64", i64 signext %"c::Int64", i64 signext %"d::Int64", i64 signext %"g[0]::Int64") #0 { top: %0 = alloca [2 x {}*], align 8 %gcframe3 = alloca [4 x {}*], align 16 %gcframe3.sub = getelementptr inbounds [4 x {}*], [4 x {}*]* %gcframe3, i64 0, i64 0 %1 = bitcast [4 x {}*]* %gcframe3 to i8* call void @llvm.memset.p0i8.i64(i8* align 16 %1, i8 0, i64 32, i1 true) %thread_ptr = call i8* asm "movq %fs:0, $0", "=r"() #7 %tls_ppgcstack = getelementptr i8, i8* %thread_ptr, i64 -8 %2 = bitcast i8* %tls_ppgcstack to {}**** %tls_pgcstack = load {}***, {}**** %2, align 8 ; @ REPL[1]:3 within `f` %3 = bitcast [4 x {}*]* %gcframe3 to i64* store i64 8, i64* %3, align 16 %4 = getelementptr inbounds [4 x {}*], [4 x {}*]* %gcframe3, i64 0, i64 1 %5 = bitcast {}** %4 to {}*** %6 = load {}**, {}*** %tls_pgcstack, align 8 store {}** %6, {}*** %5, align 8 %7 = bitcast {}*** %tls_pgcstack to {}*** store {}** %gcframe3.sub, {}*** %7, align 8 %Main.does_not_exist.cached = load atomic {}*, {}** @0 unordered, align 8 %iscached.not = icmp eq {}* %Main.does_not_exist.cached, null br i1 %iscached.not, label %notfound, label %found notfound: ; preds = %top %Main.does_not_exist.found = call {}* @ijl_get_binding_or_error({}* nonnull inttoptr (i64 139831437630272 to {}*), {}* nonnull inttoptr (i64 139831600565400 to {}*)) store atomic {}* %Main.does_not_exist.found, {}** @0 release, align 8 br label %found found: ; preds = %notfound, %top %Main.does_not_exist = phi {}* [ %Main.does_not_exist.cached, %top ], [ %Main.does_not_exist.found, %notfound ] %8 = bitcast {}* %Main.does_not_exist to {}** %does_not_exist.checked = load atomic {}*, {}** %8 unordered, align 8 %.not = icmp eq {}* %does_not_exist.checked, null br i1 %.not, label %err, label %ok err: ; preds = %found call void @ijl_undefined_var_error({}* inttoptr (i64 139831600565400 to {}*)) unreachable ok: ; preds = %found %.sub = getelementptr inbounds [2 x {}*], [2 x {}*]* %0, i64 0, i64 0 ; @ REPL[1]:2 within `f` ; ┌ @ operators.jl:587 within `+` @ int.jl:87 %9 = add i64 %"b::Int64", %"a::Int64" %10 = add i64 %9, %"c::Int64" ; │ @ operators.jl:587 within `+` ; │┌ @ operators.jl:544 within `afoldl` ; ││┌ @ int.jl:87 within `+` %11 = add i64 %10, %"d::Int64" %12 = getelementptr inbounds [4 x {}*], [4 x {}*]* %gcframe3, i64 0, i64 3 store {}* %does_not_exist.checked, {}** %12, align 8 ; └└└ ; @ REPL[1]:3 within `f` %13 = call nonnull {}* @ijl_box_int64(i64 signext %11) %14 = getelementptr inbounds [4 x {}*], [4 x {}*]* %gcframe3, i64 0, i64 2 store {}* %13, {}** %14, align 16 store {}* %13, {}** %.sub, align 8 %15 = call nonnull {}* @ijl_apply_generic({}* nonnull %does_not_exist.checked, {}** nonnull %.sub, i32 1) store {}* %15, {}** %12, align 8 %16 = call nonnull {}* @ijl_box_int64(i64 signext %11) store {}* %16, {}** %14, align 16 store {}* %15, {}** %.sub, align 8 %17 = getelementptr inbounds [2 x {}*], [2 x {}*]* %0, i64 0, i64 1 store {}* %16, {}** %17, align 8 %18 = call nonnull {}* @ijl_apply_generic({}* inttoptr (i64 139831370516384 to {}*), {}** nonnull %.sub, i32 2) %19 = load {}*, {}** %4, align 8 %20 = bitcast {}*** %tls_pgcstack to {}** store {}* %19, {}** %20, align 8 ; @ REPL[1]:4 within `f` ret {}* %18 } ``` </details> <details> <summary>Example 2</summary> ```julia julia> function g(a, b, c, d; kwarg=0) a + b + c + d + kwarg end g (generic function with 1 method) julia> @code_llvm g(0,0,0,0,kwarg=0) ``` ```llvm ; @ REPL[3]:1 within `g` define i64 @julia_g_160([1 x i64]* nocapture noundef nonnull readonly align 8 dereferenceable(8) %"#1::NamedTuple", i64 signext %"a::Int64", i64 signext %"b::Int64", i64 signext %"c::Int64", i64 signext %"d::Int64") #0 { top: %0 = getelementptr inbounds [1 x i64], [1 x i64]* %"#1::NamedTuple", i64 0, i64 0 ; ┌ @ REPL[3]:2 within `#g#1` ; │┌ @ operators.jl:587 within `+` @ int.jl:87 %1 = add i64 %"b::Int64", %"a::Int64" %2 = add i64 %1, %"c::Int64" ; ││ @ operators.jl:587 within `+` ; ││┌ @ operators.jl:544 within `afoldl` ; │││┌ @ int.jl:87 within `+` %3 = add i64 %2, %"d::Int64" ; │││└ ; │││ @ operators.jl:545 within `afoldl` ; │││┌ @ int.jl:87 within `+` %unbox = load i64, i64* %0, align 8 %4 = add i64 %3, %unbox ; └└└└ ret i64 %4 } ``` </details> 15 July 2023, 15:36:26 UTC
f15eb4e Make `Broadcast.flatten(bc).f` more complier frendly. (better inferred and inlined) (#43322) A follow up attemp to fix #27988. (close #47493 close #50554) Examples: ```julia julia> using LazyArrays julia> bc = @~ @. 1*(1 + 1) + 1*1; julia> bc2 = @~ 1 .* 1 .- 1 .* 1 .^2 .+ 1 .* 1 .+ 1 .^ 3; ``` On master: <details><summary> click for details </summary> <p> ```julia julia> @code_typed Broadcast.flatten(bc).f(1,1,1,1,1) CodeInfo( 1 ─ %1 = Core.getfield(args, 1)::Int64 │ %2 = Core.getfield(args, 2)::Int64 │ %3 = Core.getfield(args, 3)::Int64 │ %4 = Core.getfield(args, 4)::Int64 │ %5 = Core.getfield(args, 5)::Int64 │ %6 = invoke Base.Broadcast.var"#13#14"{Base.Broadcast.var"#16#18"{Base.Broadcast.var"#15#17", Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}, typeof(+)}}(Base.Broadcast.var"#16#18"{Base.Broadcast.var"#15#17", Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}, typeof(+)}(Base.Broadcast.var"#15#17"(), Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}(Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}(Base.Broadcast.var"#15#17"())), Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"())), Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"())), +))(%1::Int64, %2::Int64, %3::Vararg{Int64}, %4, %5)::Tuple{Int64, Int64, Vararg{Int64}} │ %7 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"())), %6)::Tuple{Int64, Int64} │ %8 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"())), %6)::Tuple{Vararg{Int64}} │ %9 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#16#18"{Base.Broadcast.var"#9#11", Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}, typeof(*)}(Base.Broadcast.var"#9#11"(), Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}(Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}(Base.Broadcast.var"#15#17"())), Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"())), Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"())), *), %8)::Tuple{Int64} │ %10 = Core.getfield(%7, 1)::Int64 │ %11 = Core.getfield(%7, 2)::Int64 │ %12 = Base.mul_int(%10, %11)::Int64 │ %13 = Core.getfield(%9, 1)::Int64 │ %14 = Base.add_int(%12, %13)::Int64 └── return %14 ) => Int64 julia> @code_typed Broadcast.flatten(bc2).f(1,1,1,^,1,Val(2),1,1,^,1,Val(3)) CodeInfo( 1 ─ %1 = Core.getfield(args, 1)::Int64 │ %2 = Core.getfield(args, 2)::Int64 │ %3 = Core.getfield(args, 3)::Int64 │ %4 = Core.getfield(args, 5)::Int64 │ %5 = Core.getfield(args, 7)::Int64 │ %6 = Core.getfield(args, 8)::Int64 │ %7 = Core.getfield(args, 10)::Int64 │ %8 = invoke Base.Broadcast.var"#13#14"{Base.Broadcast.var"#16#18"{Base.Broadcast.var"#15#17", Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}}, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}}, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}}, typeof(Base.literal_pow)}}(Base.Broadcast.var"#16#18"{Base.Broadcast.var"#15#17", Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}}, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}}, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}}, typeof(Base.literal_pow)}(Base.Broadcast.var"#15#17"(), Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}}(Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}(Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}(Base.Broadcast.var"#15#17"()))), Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"()))), Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"()))), Base.literal_pow))(%3::Int64, ^::Function, %4::Vararg{Any}, $(QuoteNode(Val{2}())), %5, %6, ^, %7, $(QuoteNode(Val{3}())))::Tuple{Int64, Any, Vararg{Any}} │ %9 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"())), %8)::Tuple{Int64, Any} │ %10 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"())), %8)::Tuple │ %11 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#15#17"(), %10)::Tuple │ %12 = Core.getfield(%9, 1)::Int64 │ %13 = Core.getfield(%9, 2)::Any │ %14 = (*)(%12, %13)::Any │ %15 = Core.tuple(%14)::Tuple{Any} │ %16 = Core._apply_iterate(Base.iterate, Core.tuple, %15, %11)::Tuple{Any, Vararg{Any}} │ %17 = Base.mul_int(%1, %2)::Int64 │ %18 = Core.tuple(%17)::Tuple{Int64} │ %19 = Core._apply_iterate(Base.iterate, Core.tuple, %18, %16)::Tuple{Int64, Any, Vararg{Any}} │ %20 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"())), %19)::Tuple{Int64, Any} │ %21 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"())), %19)::Tuple │ %22 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#16#18"{Base.Broadcast.var"#15#17", Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}, typeof(*)}(Base.Broadcast.var"#15#17"(), Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}(Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}(Base.Broadcast.var"#15#17"())), Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"())), Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"())), *), %21)::Tuple{Any, Vararg{Any}} │ %23 = Core.getfield(%20, 1)::Int64 │ %24 = Core.getfield(%20, 2)::Any │ %25 = (-)(%23, %24)::Any │ %26 = Core.tuple(%25)::Tuple{Any} │ %27 = Core._apply_iterate(Base.iterate, Core.tuple, %26, %22)::Tuple{Any, Any, Vararg{Any}} │ %28 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"())), %27)::Tuple{Any, Any} │ %29 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"())), %27)::Tuple │ %30 = Core._apply_iterate(Base.iterate, Base.Broadcast.var"#16#18"{Base.Broadcast.var"#9#11", Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}}, Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}}, Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}}, typeof(Base.literal_pow)}(Base.Broadcast.var"#9#11"(), Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}}(Base.Broadcast.var"#13#14"{Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}}(Base.Broadcast.var"#13#14"{Base.Broadcast.var"#15#17"}(Base.Broadcast.var"#15#17"()))), Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}}(Base.Broadcast.var"#23#24"{Base.Broadcast.var"#25#26"}(Base.Broadcast.var"#25#26"()))), Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}}(Base.Broadcast.var"#19#20"{Base.Broadcast.var"#21#22"}(Base.Broadcast.var"#21#22"()))), Base.literal_pow), %29)::Tuple{Any} │ %31 = Core.getfield(%28, 1)::Any │ %32 = Core.getfield(%28, 2)::Any │ %33 = (+)(%31, %32)::Any │ %34 = Core.getfield(%30, 1)::Any │ %35 = (+)(%33, %34)::Any └── return %35 ) => Any ``` </p> </details> On this PR ```julia julia> @code_typed Broadcast.flatten(bc).f(1,1,1,1,1) CodeInfo( 1 ─ %1 = Core.getfield(args, 1)::Int64 │ %2 = Core.getfield(args, 2)::Int64 │ %3 = Core.getfield(args, 3)::Int64 │ %4 = Core.getfield(args, 4)::Int64 │ %5 = Core.getfield(args, 5)::Int64 │ %6 = Base.add_int(%2, %3)::Int64 │ %7 = Base.mul_int(%1, %6)::Int64 │ %8 = Base.mul_int(%4, %5)::Int64 │ %9 = Base.add_int(%7, %8)::Int64 └── return %9 ) => Int64 julia> @code_typed Broadcast.flatten(bc2).f(1,1,1,^,1,Val(2),1,1,^,1,Val(3)) CodeInfo( 1 ─ %1 = Core.getfield(args, 1)::Int64 │ %2 = Core.getfield(args, 2)::Int64 │ %3 = Core.getfield(args, 3)::Int64 │ %4 = Core.getfield(args, 5)::Int64 │ %5 = Core.getfield(args, 7)::Int64 │ %6 = Core.getfield(args, 8)::Int64 │ %7 = Core.getfield(args, 10)::Int64 │ %8 = Base.mul_int(%1, %2)::Int64 │ %9 = Base.mul_int(%4, %4)::Int64 │ %10 = Base.mul_int(%3, %9)::Int64 │ %11 = Base.sub_int(%8, %10)::Int64 │ %12 = Base.mul_int(%5, %6)::Int64 │ %13 = Base.add_int(%11, %12)::Int64 │ %14 = Base.mul_int(%7, %7)::Int64 │ %15 = Base.mul_int(%14, %7)::Int64 │ %16 = Base.add_int(%13, %15)::Int64 └── return %16 ) => Int64 ``` 15 July 2023, 12:40:08 UTC
e464218 tabs to space 15 July 2023, 05:49:48 UTC
3c9522d sroa: Fix accidentally dropped condition Fixes the issue noted in [1] (#50522) and adds a test to make sure that it doesn't regress. [1] https://github.com/JuliaLang/julia/commit/9b73611072b32b40c0d3abe14700515380c26848#r121641452 15 July 2023, 05:49:48 UTC
cd74337 Also record chained `innervars` At present we only record direct `innervars` (`T` -> `S<:Val{T}`). And chained `innervars` might be ignored (`T` -> `S<:Val{V<:T}`\ This commit fix it. 15 July 2023, 04:35:13 UTC
d406c7e make flattened `Broadcasted` more compiler friendly. 1. make `cat_nested` better inferred by switching to direct self-recursion. 2. `make_makeargs` now create a tuple of functions which take in the whole argument list and return the corresponding input for the broadcasted function. 15 July 2023, 02:11:49 UTC
back to top