- Aug 30, 2020
-
-
sstefan1 authored
The problem with module slice has been addressed in D86319 Introduce two new AAs. AAICVTrackerFunctionReturned which checks if a function can have a unique ICV value after it is finished, and AAICVCallSiteReturned which checks AAICVTrackerFunctionReturned for a call site. This enables us to check the value of a call and if it changes the ICV. This also changes the approach in `getReplacementValues()` to a worklist-based approach so we can explore all relevant BBs. Differential Revision: https://reviews.llvm.org/D85544
-
sstefan1 authored
Summary: The module slice describes which functions we can analyze and transform while working on an SCC as part of the Attributor-CGSCC pass. So far we simply restricted it to the SCC. Reviewers: jdoerfert Differential Revision: https://reviews.llvm.org/D86319
-
Kamlesh Kumar authored
Differential Revision: https://reviews.llvm.org/D86848
-
sstefan1 authored
-
Juneyoung Lee authored
-
Juneyoung Lee authored
This patch makes LangRef be explicit about the value of padding when storing an aggregate. It states that when an aggregate is stored into memory, padding is filled with undef. Here is a clue that supports this change (edited to reflect the discussion from llvm-dev): - IPSCCP ignores padding and directly stores a constant aggregate if possible. It loses the data stored in the padding. https://godbolt.org/z/xzenYs Memcpyopt ignores (the preexisting value of) padding when copying an aggregate or storing a constant: https://godbolt.org/z/hY6ndd / https://godbolt.org/z/3WMP5a The two items below are not relevant with this patch because Clang lowers load/store of individual field of struct into load/stores of the corresponding pointer with a primitive type. Also, when copy is needed, it uses memcpy instead of load/store of an aggregate, as discussed in the llvm-dev. However, this patch is still valid (as discussed) because it is needed to explain the two optimizations above. - According to C17, the value of padding bytes when storing values in structures or unions is unspecified. - I updated Alive2 and it did not find any problematic transformation from LLVM unit tests and while running translation validation of a few C programs. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D86189
-
Shinji Okumura authored
This is the next patch of D86842 When we check `noundef` attribute violation at callsites, we do not have to require `nonnull` in the following two cases. 1. An argument is known to be simplified to undef 2. An argument is known to be dead Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D86845
-
Shinji Okumura authored
This patch fixes wrong dependency type in AAUB. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D86842
-
Fangrui Song authored
Otherwise their alignment is dependent on the size of the section. If the size is large than 16, the alignment will be 16. 16 is a bad choice for both .llvmbc and .llvmcmd because the padding between two contributions from input sections is of a variable size. A bitstream is actually guaranteed to be 4-byte aligned, but consumers don't need this property.
-
Brad Smith authored
-
Lang Hames authored
DFS and Reverse-DFS linkage orders are used to order execution of deinitializers and initializers respectively. This patch replaces uses of special purpose DFS order functions in MachOPlatform and LLJIT with uses of the new methods.
-
Louis Dionne authored
This ensures that existing CMake build trees will start using the new default without having to nuke their build directories.
-
Louis Dionne authored
-
Louis Dionne authored
This commit adds the first from-scratch configuration files for running the libc++ test suite without using the old configuration: - libcxx-trunk-shared.cfg.py: Runs the test suite against a trunk libc++ shared library. - libcxx-trunk-static.cfg.py: Runs the test suite against a trunk libc++ static library. Differential Revision: https://reviews.llvm.org/D81866
-
Shinji Okumura authored
Even though `noundef` IR attribute might be attached to non-void type values, AANoUndef is mistakenly identified for pointer type values only. This patch fixes that. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D86737
-
Nikita Popov authored
Canonicalize icmp ne to icmp eq and implement all the folds only once.
-
Nikita Popov authored
Replace the check for poison-producing instructions in SimplifyWithOpReplaced() with the generic helper canCreatePoison() that properly handles poisonous shifts and thus avoids the problem from PR47322. This additionally fixes a bug in IIQ.UseInstrInfo=false mode, which previously could have caused this code to ignore poison flags. Setting UseInstrInfo=false should reduce the possible optimizations, not increase them. This is not a full solution to the problem, as poison could be introduced more indirectly. This is just a minimal, easy to backport fix. Differential Revision: https://reviews.llvm.org/D86834
-
Florian Hahn authored
Move bail out when optimizing for size before runtime check generation. In that case, we do not use the result of the expansion, the expanded instruction will be dead and cleaned up later. By doing the check before expanding the runtime-checks, we can save a bit of unnecessary work.
-
Nikita Popov authored
-
Nikita Popov authored
This got reverted because a dependency was reverted. It has since been reapplied, so reapply this as well. ----- Related to D69686. As noted there, LVI currently behaves differently for integer and pointer values: For integers, the block value is always valid inside the basic block, while for pointers it is only valid at the end of the basic block. I believe the integer behavior is the correct one, and CVP relies on it via its getConstantRange() uses. The reason for the special pointer behavior is that LVI checks whether a pointer is dereferenced in a given basic block and marks it as non-null in that case. Of course, this information is valid only after the dereferencing instruction, or in conservative approximation, at the end of the block. This patch changes the treatment of dereferencability: Instead of including it inside the block value, we instead treat it as something similar to an assume (it essentially is a non-nullness assume) and incorporate this information in intersectAssumeOrGuardBlockValueConstantRange() if the context instruction is the terminator of the basic block. This happens either when determining an edge-value internally in LVI, or when a terminator was explicitly passed to getValueAt(). The latter case makes this more powerful than the previous implementation as a side-effect, and this does actually seem benefitial in practice. Of course, we do not want to recompute dereferencability on each intersectAssume call, so we need a new cache for this. The dereferencability analysis requires walking the entire basic block and computing underlying objects of all memory operands. This was previously done separately for each queried pointer value. In the new implementation (both because this makes the caching simpler, and because it is faster), I instead only walk the full BB once and cache all the dereferenced pointers. So the traversal is now performed only once per BB, instead of once per queried pointer value. I think the overall model now makes more sense than before, and there will be no more pitfalls due to differing integer/pointer behavior. Differential Revision: https://reviews.llvm.org/D69914
-
Roman Lebedev authored
-
Roman Lebedev authored
EarlyCSE has a mode to verify the invariant that hash equality equals key equality, but EliminateDuplicatePHINodes() doesn't. I've verified that this would have caught the stage2-stage3 mismatches 5ec2b757 revert has fixed, that were introduced last time in 3e69871a.
-
Shinji Okumura authored
This patch fixes AANoUndef manifestation. We should not manifest noundef for positions that will be changed to undef. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D86835
-
sstefan1 authored
-
Florian Hahn authored
A MemoryPhi can never be eliminated. If we hit one, return the Phi, so the caller can continue traversing the incoming accesses. This saves some unnecessary read clobber checks and improves compile-time http://llvm-compile-time-tracker.com/compare.php?from=1ffc58b6d098ce8fa71f3a80fe75b990f633f921&to=d0fa8d1982380b57d7b6067528104bc373dbe07a&stat=instructions
-
Benjamin Kramer authored
-
Aaron Puchert authored
Instead of writing to a flag and then returning based on that flag we can also return directly. The flag name also doesn't provide additional information, it just reflects the name of the function (isReferenced).
-
Aaron Puchert authored
Not sure if this has any effect, but it was inconsistent before. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D67113
-
Roman Lebedev authored
The stage2-stage3 differences persist even without instcombine-based PHI CSE, so this is the only possible reason.
-
Sanjay Patel authored
Handling the new min/max intrinsics is the motivation, but it turns out that we have a bunch of other intrinsics with this missing bit of analysis too. The FP min/max tests show that we are intersecting FMF, so that part should be safe too. As noted in https://llvm.org/PR46897 , there is a commutative property specifier for intrinsics, but no corresponding function attribute, and so apparently no uses of that bit. We may want to remove that next. Follow-up patches should wire up the Instruction::isCommutative() to this IntrinsicInst specialization. That requires updating callers to be aware of the more general commutative property (not just binops). Differential Revision: https://reviews.llvm.org/D86798
-
Sanjay Patel authored
-
Nikita Popov authored
-
- Aug 29, 2020
-
-
Roman Lebedev authored
The original take 1 was 6102310d, which taught InstSimplify to do that, which seemed better at time, since we got EarlyCSE support for free. However, it was proven that we can not do that there, the simplified-to PHI would not be reachable from the original PHI, and that is not something InstSimplify is allowed to do, as noted in the commit ed90f15e that reverted it: > It appears to cause compilation non-determinism and caused stage3 mismatches. Then there was take 2 3e69871a, which was InstCombine-specific, but it again showed stage2-stage3 differences, and reverted in bdaa3f86. This is quite alarming. Here, let's try to change how we find existing PHI candidate: due to the worklist order, and the way PHI nodes are inserted (it may be inserted as the first one, or maybe not), let's look at *all* PHI nodes in the block. Effects on vanilla llvm test-suite + RawSpeed: ``` | statistic name | baseline | proposed | Δ | % | \|%\| | |----------------------------------------------------|-----------|-----------|-------:|---------:|---------:| | asm-printer.EmittedInsts | 7942329 | 7942457 | 128 | 0.00% | 0.00% | | assembler.ObjectBytes | 254295632 | 254312480 | 16848 | 0.01% | 0.01% | | correlated-value-propagation.NumPhis | 18412 | 18347 | -65 | -0.35% | 0.35% | | early-cse.NumCSE | 2183283 | 2183267 | -16 | 0.00% | 0.00% | | early-cse.NumSimplify | 550105 | 541842 | -8263 | -1.50% | 1.50% | | instcombine.NumAggregateReconstructionsSimplified | 73 | 4506 | 4433 | 6072.60% | 6072.60% | | instcombine.NumCombined | 3640311 | 3644419 | 4108 | 0.11% | 0.11% | | instcombine.NumDeadInst | 1778204 | 1783205 | 5001 | 0.28% | 0.28% | | instcombine.NumPHICSEs | 0 | 22490 | 22490 | 0.00% | 0.00% | | instcombine.NumWorklistIterations | 2023272 | 2024400 | 1128 | 0.06% | 0.06% | | instcount.NumCallInst | 1758395 | 1758802 | 407 | 0.02% | 0.02% | | instcount.NumInvokeInst | 59478 | 59502 | 24 | 0.04% | 0.04% | | instcount.NumPHIInst | 330557 | 330545 | -12 | 0.00% | 0.00% | | instcount.TotalBlocks | 1077138 | 1077220 | 82 | 0.01% | 0.01% | | instcount.TotalFuncs | 101442 | 101441 | -1 | 0.00% | 0.00% | | instcount.TotalInsts | 8831946 | 8832606 | 660 | 0.01% | 0.01% | | simplifycfg.NumHoistCommonCode | 24186 | 24187 | 1 | 0.00% | 0.00% | | simplifycfg.NumInvokes | 4300 | 4410 | 110 | 2.56% | 2.56% | | simplifycfg.NumSimpl | 1019813 | 999767 | -20046 | -1.97% | 1.97% | ``` So it fires 22490 times, which is less than ~24k the take 1 did, but more than what take 2 did (22228 times) . It allows foldAggregateConstructionIntoAggregateReuse() to actually work after PHI-of-extractvalue folds did their thing. Previously SimplifyCFG would have done this PHI CSE, of all places. Additionally, allows some more `invoke`->`call` folds to happen (+110, +2.56%). All in all, expectedly, this catches less things overall, but all the motivational cases are still caught, so all good.
-
sstefan1 authored
-
Roman Lebedev authored
While the original variant with doing this in InstSimplify (rightfully) caused questions and ultimately was detected to be a culprit of stage2-stage3 mismatch, it was expected that InstCombine-based implementation would be fine. But apparently it's not, as http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/24095/steps/compare-compilers/logs/stdio suggests. Which suggests that somewhere in InstCombine there is a loop over nondeterministically sorted container, which causes different worklist ordering. This reverts commit 3e69871a.
-
Nikita Popov authored
Follow the usual usage pattern for this function and return the result.
-
Martin Storsjö authored
This ensures that you get the same output regardless if generating code directly to an object file or if generating assembly and assembling that. Add implementations of the EmitARM64WinCFI*() methods in AArch64TargetAsmStreamer, and fill in one blank in MCAsmStreamer. Add corresponding directive handlers in AArch64AsmParser and COFFAsmParser. Some SEH directive names have been picked to match the prior art for SEH assembly directives for x86_64, e.g. the spelling of ".seh_startepilogue" matching the preexisting ".seh_endprologue". For the directives for saving registers, the exact spelling from the arm64 documentation is picked, e.g. ".seh_save_reg" (to follow that naming for all the other ones, e.g. ".seh_save_fregp_x"), while the corresponding one for x86_64 is plain ".seh_savereg" without the second underscore. Directives in the epilogues have the same names as in prologues, e.g. .seh_savereg, even though the registers are restored, not saved, at that point. Differential Revision: https://reviews.llvm.org/D86529
-
Martin Storsjö authored
This can happen e.g. for code that declare .seh_proc/.seh_endproc in assembly, or for code that use .seh_handlerdata (which triggers the unwind info to be emitted before the end of the function). The TextSection field must be made non-const to be able to use it with Streamer.SwitchSection(). Differential Revision: https://reviews.llvm.org/D86528
-
Roman Lebedev authored
[InstCombine] foldAggregateConstructionIntoAggregateReuse(): use InstCombiner::replaceInstUsesWith() instead of RAUW We really shouldn't use RAUW in InstCombine because we should consistently update Worklist to avoid extra iterations.
-
Roman Lebedev authored
We really shouldn't use RAUW in InstCombine because we should consistently update Worklist to avoid extra iterations.
-