summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/StraightLineStrengthReduce
Commit message (Collapse)AuthorAgeFilesLines
* Migrate function attribute "no-frame-pointer-elim"="false" to ↵Fangrui Song2019-12-241-1/+1
| | | | "frame-pointer"="none" as cleanups after D56351
* Revert "Temporarily Revert "Add basic loop fusion pass.""Eric Christopher2019-04-1711-0/+832
| | | | | | | | The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
* Temporarily Revert "Add basic loop fusion pass."Eric Christopher2019-04-1711-832/+0
| | | | | | | | As it's causing some bot failures (and per request from kbarton). This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda. llvm-svn: 358546
* [SLSR] use 'match' to simplify code; NFCSanjay Patel2018-10-231-0/+29
| | | | | | | | | This pass could probably be modified slightly to allow vector splat transforms for practically no cost, but it only works on scalars for now. So the use of the newer 'match' API should make no functional difference. llvm-svn: 345030
* [SLSR] auto-generate full test assertions; NFCSanjay Patel2018-10-231-52/+79
| | | | llvm-svn: 345028
* AMDGPU: Mark all unspecified CC functions in tests as amdgpu_kernelMatt Arsenault2017-03-211-4/+4
| | | | | | | | | | | | Currently the default C calling convention functions are treated the same as compute kernels. Make this explicit so the default calling convention can be changed to a non-kernel. Converted with perl -pi -e 's/define void/define amdgpu_kernel void/' on the relevant test directories (and undoing in one place that actually wanted a non-kernel). llvm-svn: 298444
* [SLSR] Call getPointerSizeInBits with the correct address space.Jingyue Wu2016-07-111-3/+20
| | | | llvm-svn: 275083
* [SLSR] Fix crash on handling 128-bit integers.Jingyue Wu2016-07-092-32/+53
| | | | | | | | | ConstantInt::getSExtValue may fail on >64-bit integers. Add checks to call getSExtValue only on narrow integers. As a minor aside, simplify slsr-gep.ll to remove unnecessary load instructions. llvm-svn: 274982
* [SeparateConstOffsetFromGEP] strengthen the inbounds attributeJingyue Wu2015-08-131-2/+2
| | | | | | | | | | | | | | We used to be over-conservative about preserving inbounds. Actually, the second GEP (which applies the constant offset) can inherit the inbounds attribute of the original GEP, because the resultant pointer is equivalent to that of the original GEP. For example, x = GEP inbounds a, i+5 => y = GEP a, i // inbounds removed x = GEP inbounds y, 5 // inbounds preserved llvm-svn: 244937
* [NVPTX] enable SpeculativeExecution in NVPTXJingyue Wu2015-07-161-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: SpeculativeExecution enables a series straight line optimizations (such as SLSR and NaryReassociate) on conditional code. For example, if (...) ... b * s ... if (...) ... (b + 1) * s ... speculative execution can hoist b * s and (b + 1) * s from then-blocks, so that we have ... b * s ... if (...) ... ... (b + 1) * s ... if (...) ... Then, SLSR can rewrite (b + 1) * s to (b * s + s) because after speculative execution b * s dominates (b + 1) * s. The performance impact of this change is significant. It speeds up the benchmarks running EigenFloatContractionKernelInternal16x16 (https://bitbucket.org/eigen/eigen/src/ba68f42fa69e4f43417fe1e52669d4dd5d2b3bee/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h?at=default#cl-526) by roughly 2%. Some internal benchmarks that have the above code pattern are improved by up to 40%. No significant slowdowns are observed on Eigen CUDA microbenchmarks. Reviewers: jholewinski, broune, eliben Subscribers: llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D11201 llvm-svn: 242437
* [SLSR] S's basis must have the same type as SJingyue Wu2015-06-281-0/+20
| | | | llvm-svn: 240910
* AMDGPU: Fix some places missed in renameMatt Arsenault2015-06-193-2/+2
| | | | llvm-svn: 240143
* SLSR: Pass address space to isLegalAddressingModeMatt Arsenault2015-06-112-0/+109
| | | | | | | | | This only updates one of the uses. The other is used in cases that may never touch memory, so I'm not sure why this is even calling it. Perhaps there should be a new, similar hook for such cases or pass -1 for unknown address space. llvm-svn: 239540
* [SLSR] handle (B | i) * SJingyue Wu2015-05-151-0/+23
| | | | | | | | | | | | | | | | Summary: Consider (B | i) * S as (B + i) * S if B and i have no bits set in common. Test Plan: @or in slsr-mul.ll Reviewers: broune, meheff Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9788 llvm-svn: 237456
* [SLSR] handles non-canonicalized Mul candidatesJingyue Wu2015-05-131-0/+21
| | | | | | | | such as (2 + B) * S. Tested by @non_canonicalized in slsr-mul.ll llvm-svn: 237216
* [NVPTX] run SeparateConstOffsetFromGEP before SLSRJingyue Wu2015-04-232-0/+76
| | | | | | | | | | | | | | | | | | Summary: We pick this order because SeparateConstOffsetFromGEP may create more opportunities for SLSR. Test Plan: reassociate-geps-and-slsr.ll no performance regression on internal benchmarks Reviewers: meheff Subscribers: llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D9230 llvm-svn: 235632
* [SLSR] garbage-collect unused instructionsJingyue Wu2015-04-214-4/+4
| | | | | | | | | | | | | | | | | Summary: After we rewrite a candidate, the instructions used by the old form may become unused. This patch cleans up these unused instructions so that we needn't run DCE after SLSR. Test Plan: removed -dce in all the SLSR tests Reviewers: broune, meheff Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9101 llvm-svn: 235410
* [NFC] [SLSR] clean up some testsJingyue Wu2015-04-153-83/+99
| | | | llvm-svn: 235021
* [SLSR] handle candidate form (B + i * S)Jingyue Wu2015-04-153-3/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With this patch, SLSR may rewrite S1: X = B + i * S S2: Y = B + i' * S to S2: Y = X + (i' - i) * S A secondary improvement: if (i' - i) is a power of 2, emit Y as X + (S << log(i' - i)). (S << log(i' -i)) is in a canonical form and thus more likely GVN'ed than (i' - i) * S. Test Plan: slsr-add.ll Reviewers: hfinkel, sanjoy, meheff, broune, eliben Reviewed By: eliben Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8983 llvm-svn: 235019
* [SLSR] consider &B[S << i] as &B[(1 << i) * S]Jingyue Wu2015-04-061-5/+5
| | | | | | | | | | | | | | Summary: This reduces handling &B[(1 << i) * s] to handling &B[i * S]. Test Plan: slsr-gep.ll Reviewers: meheff Subscribers: sanjoy, llvm-commits Differential Revision: http://reviews.llvm.org/D8837 llvm-svn: 234180
* [SLSR] handles off bounds GEPsJingyue Wu2015-04-021-0/+25
| | | | | | | | | | | | | | | | | | Summary: The old requirement on GEP candidates being in bounds is unnecessary. For off-bound GEPs, we still have &B[i * S] = B + (i * S) * e = B + (i * e) * S Test Plan: slsr_offbound_gep in slsr-gep.ll Reviewers: meheff Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8809 llvm-svn: 233949
* [SLSR] handle candidate form &B[i * S]Jingyue Wu2015-03-264-0/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch enhances SLSR to handle another candidate form &B[i * S]. If we found two candidates S1: X = &B[i * S] S2: Y = &B[i' * S] and S1 dominates S2, we can replace S2 with Y = &X[(i' - i) * S] Test Plan: slsr-gep.ll X86/no-slsr.ll: verify that we do not run SLSR on GEPs that already fit into an addressing mode Reviewers: eliben, atrick, meheff, hfinkel Reviewed By: hfinkel Subscribers: sanjoy, llvm-commits Differential Revision: http://reviews.llvm.org/D7459 llvm-svn: 233286
* Add straight-line strength reduction to LLVMJingyue Wu2015-02-031-0/+119
Summary: Straight-line strength reduction (SLSR) is implemented in GCC but not yet in LLVM. It has proven to effectively simplify statements derived from an unrolled loop, and can potentially benefit many other cases too. For example, LLVM unrolls #pragma unroll foo (int i = 0; i < 3; ++i) { sum += foo((b + i) * s); } into sum += foo(b * s); sum += foo((b + 1) * s); sum += foo((b + 2) * s); However, no optimizations yet reduce the internal redundancy of the three expressions: b * s (b + 1) * s (b + 2) * s With SLSR, LLVM can optimize these three expressions into: t1 = b * s t2 = t1 + s t3 = t2 + s This commit is only an initial step towards implementing a series of such optimizations. I will implement more (see TODO in the file commentary) in the near future. This optimization is enabled for the NVPTX backend for now. However, I am more than happy to push it to the standard optimization pipeline after more thorough performance tests. Test Plan: test/StraightLineStrengthReduce/slsr.ll Reviewers: eliben, HaoLiu, meheff, hfinkel, jholewinski, atrick Reviewed By: jholewinski, atrick Subscribers: karthikthecool, jholewinski, llvm-commits Differential Revision: http://reviews.llvm.org/D7310 llvm-svn: 228016
OpenPOWER on IntegriCloud