- May 22, 2024
-
-
mingmingl authored
1. Set 'import-instr-evolution-factor' to 1.0 (default 0.7) to make sure import limit remains 7 (otherwise import limit decays through each edge) 2. Updated bar* function names 3. Explain why aliasee is null for bar* functions
-
- May 21, 2024
-
-
mingmingl authored
-
- May 20, 2024
-
-
mingmingl authored
-
Mingming Liu authored
[ThinLTO] Populate declaration import status except for distributed ThinLTO under a default-off new option (#88024) The goal is to populate `declaration` import status if a new flag`-import-declaration` is on. * For in-process ThinLTO, the `declaration` status is visible to backend `function-import` pass, so `FunctionImporter::importFunctions` should read the import status and be no-op for declaration summaries. Basically, the postlink pipeline is updated to keep its current behavior (import definitions), but not updated to handle `declaration` summaries. Two use cases (better call-graph sort and cross-module auto-init) would use this bit differently. * For distributed ThinLTO, the `declaration` status is not serialized to bitcode. As discussed, https://github.com/llvm/llvm-project/pull/87600 will do this. [1] https://discourse.llvm.org/t/rfc-for-better-call-graph-sort-build-a-more-complete-call-graph-by-adding-more-indirect-call-edges/74029#support-cross-module-function-declaration-import-5 [2] https://github.com/llvm/llvm-project/pull/87597#discussion_r1556067195
-
Austin Kerbow authored
Lowering of preloded arguments would fail with half/bfloat if they were dword aligned in the kernarg segment and not part of a vector. Added more tests with different alignments and types.
-
Chaitanya authored
-
Monad authored
Fold ``` llvm define i32 @src(i32 %x, i32 %y) { %base = inttoptr i32 %x to ptr %ptr = getelementptr inbounds i8, ptr %base, i32 %y %r = ptrtoint ptr %ptr to i32 ret i32 %r } ``` where both `%base` and `%ptr` have only one use, to ``` llvm define i32 @tgt(i32 %x, i32 %y) { %r = add i32 %x, %y ret i32 %r } ``` The `add` can be `nuw` if the GEP is `inbounds` and the offset is non-negative. The relevant Alive2 proof is https://alive2.llvm.org/ce/z/nP3RWy. ### Motivation It seems unnecessary to convert `int` to `ptr` just to get its offset. In most cases, they generates the same assembly, but sometimes it may miss some optimizations since the analysis of `GEP` is not as perfect as that of arithmetic operation. One example is https://github.com/dtcxzyw/llvm-opt-benchmark/blob/e3c822bf41df3a88ca38eba884a52b0cc7e70bf2/bench/protobuf/optimized/generated_message_reflection.cc.ll#L39860-L39873 ``` llvm %conv.i188 = zext i32 %145 to i64 %add.i189 = add i64 %conv.i188, %125 %146 = load i16, ptr %num_aux_entries10.i, align 2 %conv2.i191 = zext i16 %146 to i64 %mul.i192 = shl nuw nsw i64 %conv2.i191, 3 %add3.i193 = add i64 %add.i189, %mul.i192 %147 = inttoptr i64 %add3.i193 to ptr %sub.ptr.lhs.cast.i195 = ptrtoint ptr %144 to i64 %sub.ptr.rhs.cast.i196 = ptrtoint ptr %143 to i64 %sub.ptr.sub.i197 = sub i64 %sub.ptr.lhs.cast.i195, %sub.ptr.rhs.cast.i196 %add.ptr = getelementptr inbounds i8, ptr %147, i64 %sub.ptr.sub.i197 %sub.ptr.lhs.cast = ptrtoint ptr %add.ptr to i64 %sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %125 ``` where `%conv.i188` first adds `%125` and then subtracts `%125` (the result is `%sub.ptr.sub`), which can be optimized. -
Amir Ayupov authored
YAML profile for non-simple functions without CFG is 1) useless for optimizations, 2) can't be attached, similar to fdata profile, 3) would be reported as invalid/stale even if the profile is valid. Don't attempt to attach the profile in this case, aligning the behavior to DataReader. Test Plan: added yaml-non-simple.test
-
Chuanqi Xu authored
Close https://github.com/llvm/llvm-project/issues/91418 Since we load the variable's initializers lazily, it'd be problematic if the initializers dependent on each other. So here we try to load the initializers of static variables to make sure they are passed to code generator by order. If we read any thing interesting, we would consume that before emitting the current declaration.
-
Kazu Hirata authored
-
Freddy Ye authored
-
Kazu Hirata authored
-
Mingming Liu authored
[CallPromotionUtils]Implement conditional indirect call promotion with vtable-based comparison (#81378) * Given the code sequence ``` bb: %vtable = load ptr, ptr %d, !prof !8 %vfn = getelementptr inbounds ptr, ptr %vtable, i64 1 %1 = load ptr, ptr %vfn %call = tail call i32 %1(ptr %d), !prof !9 ``` The transformation looks like ``` bb: %vtable = load ptr, ptr %d, align 8 %vfn = getelementptr inbounds i8, ptr %vtable, i64 8 <-- Inst 1 %func-addr = load ptr, ptr %vfn, align 8 <-- Inst 2 # compare loaded pointers with address point of vtables %1 = icmp eq ptr %vtable, getelementptr inbounds (i8, ptr @_ZTV<VTable>, i32 16) br i1 %1, label %if.true.direct_targ, label %if.false.orig_indirect, !prof !18 if.true.direct_targ: ; preds = %bb %2 = tail call i32 @<direct-call>(ptr nonnull %d) br label %if.end.icp if.false.orig_indirect: ; preds = %bb %call = tail call i32 %func-addr(ptr nonnull %d) br label %if.end.icp if.end.icp: ; preds = %if.false.orig_indirect, %if.true.direct_targ %4 = phi i32 [ %call, %if.false.orig_indirect ], [ %2, %if.true.direct_targ ] ``` It's intentional that `Inst 1` and `Inst2` remains in `bb` (not in `if.false.orig_indirect`). A follow up patch will implement code to sink them (something like how `instcombine` would [sink](https://github.com/llvm/llvm-project/blob/2fcfc9754a16805b81e541dc8222a8b5cf17a121/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L4293) instructions along with [debug intrinsics](https://github.com/llvm/llvm-project/blob/2fcfc9754a16805b81e541dc8222a8b5cf17a121/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp#L4356-L4368) if possible) * The parent patch is https://github.com/llvm/llvm-project/pull/81181 -
Kazu Hirata authored
-
Owen Pan authored
Wherever applicable, replace EXPECT_EQ with verifyFormat and std::string with StringRef. Also, change a raw string literal to a regular one.
-
Kazu Hirata authored
-
Ryuichi Watanabe authored
-
Fangrui Song authored
Fix #92702
-
Leon Clark authored
Use LSH to lower ctlz_zero_undef instead of subtracting leading zeros for i8 and i16. Related to [77615](https://github.com/llvm/llvm-project/pull/77615 ). --------- Co-authored-by:
Leon Clark <leoclark@amd.com>
-
Amir Ayupov authored
-
Matt Arsenault authored
Treat undef as unknown, and poison as ignorable.
-
Helena Kotas authored
Add `environment` parameter to Clang availability attribute. The allowed values for this parameter are a subset of values allowed in the `llvm::Triple` environment component. If the `environment` parameters is present, the declared availability attribute applies only to targets with the same platform and environment. This new parameter will be initially used for annotating HLSL functions for the `shadermodel` platform because in HLSL built-in function availability can depend not just on the shader model version (mapped to `llvm::Triple::OSType`) but also on the target shader stage (mapped to `llvm::Triple::EnvironmentType`). See example in #89802 and microsoft/hlsl-specs#204 for more details. The environment parameter is currently supported only for HLSL. Fixes #89802
-
Isaac David authored
-
Helena Kotas authored
Design document for the HLSL availability diagnostic modes Fixes microsoft/hlsl-specs#190 --------- Co-authored-by:Xiang Li <python3kgae@outlook.com>
-
- May 19, 2024
-
-
Florian Hahn authored
Simplify a common pattern generated for masks when folding the tail. PR: https://github.com/llvm/llvm-project/pull/89386
-
Matt Arsenault authored
-
Nhat Nguyen authored
This PR is to address the issue #84640
-
aengelke authored
This saves an extra iteration over the all instructions of the function.
-
aengelke authored
This is a pure optimization to avoid redundant extensions, but iterating over all users is expensive, so don't do this at -O0.
-
Alex Voicu authored
At the moment, Clang is rather liberal in assuming that 0 (and by extension unqualified) is always a safe default. This does not work for targets that actually use a different value for the default / generic AS (for example, the SPIRV that obtains from HIPSPV or SYCL). This patch is a first, fairly safe step towards trying to clear things up by querying a modules' default AS from the target, rather than assuming it's 0, alongside fixing a few places where things break / we encode the 0 == DefaultAS assumption. A bunch of existing tests are extended to check for non-zero default AS usage.
-
Vitaly Buka authored
Issue #92687 This reverts commit 112eadd5.
-
Vitaly Buka authored
Memory leak: https://lab.llvm.org/buildbot/#/builders/5/builds/43403 Issue #92687 This reverts commit 0ec3b972.
-
Vitaly Buka authored
Revert "[Bounds-Safety] Temporarily relax a `counted_by` attribute restriction on flexible array members" Together with 0ec3b972 breaks https://lab.llvm.org/buildbot/#/builders/5/builds/43403 Issue #92687 This reverts commit cef6387e.
-
Simon Pilgrim authored
No need for this to be vector specific, and its more likely that scalar cases will appear after #92576
-
Simon Pilgrim authored
No need for this to be vector specific, and its more likely that scalar cases will appear after #92096
-
Simon Pilgrim authored
[DAG] canCreateUndefOrPoison - only compute extract/index vector elt index knownbits when not poison We were calling computeKnownBits to determine the bounds of the element index without ensuring that it wasn't poison, meaning if we did freeze the index, isGuaranteedNotToBeUndefOrPoison would then fail as we can't call computeKnownBits through FREEZE for potentially poison values. Fixes #92569
-
Vitaly Buka authored
Fixes build after cfe9deb1 on https://lab.llvm.org/buildbot/#/builders/37/builds/34828
-
Simon Pilgrim authored
The only difference is the operand index for the element index variable.
-
David Green authored
-
Yingwei Zheng authored
This patch supports `G_CONSTANT_FOLD_BARRIER` on RISCV to generate the following inst seq without crash: ``` define i64 @xor_and_i64(i64 %x) { entry: %y = and i64 %x, 16383 %z = xor i64 %y, 16368 ret i64 %z } ```
-