{"push_id":537022161,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"dcda2349b1b6609ca0de92ecd099dd025f9c7d34","before":"5da97b9f7aff135d9038fecab1fedb9197f1f69c","commits":[{"sha":"dcda2349b1b6609ca0de92ecd099dd025f9c7d34","author":{"email":"420c9fb3407b8e11ac322a0e7703f7b1f526df04@gmail.com","name":"Chandler Carruth"},"message":"[SROA] Teach SROA to be more aggressive in splitting now that we have\na pre-splitting pass over loads and stores.\n\nHistorically, splitting could cause enough problems that I hamstrung the\nentire process with a requirement that splittable integer loads and\nstores must cover the entire alloca. All smaller loads and stores were\nunsplittable to prevent chaos from ensuing. With the new pre-splitting\nlogic that does load/store pair splitting I introduced in r225061, we\ncan now very nicely handle arbitrarily splittable loads and stores. In\norder to fully benefit from these smarts, we need to mark all of the\ninteger loads and stores as splittable.\n\nHowever, we don't actually want to rewrite partitions with all integer\nloads and stores marked as splittable. This will fail to extract scalar\nintegers from aggregates, which is kind of the point of SROA. =] In\norder to resolve this, what we really want to do is only do\npre-splitting on the alloca slices with integer loads and stores fully\nsplittable. This allows us to uncover all non-integer uses of the alloca\nthat would benefit from a split in an integer load or store (and where\nintroducing the split is safe because it is just memory transfer from\na load to a store). Once done, we make all the non-whole-alloca integer\nloads and stores unsplittable just as they have historically been,\nrepartition and rewrite.\n\nThe result is that when there are integer loads and stores anywhere\nwithin an alloca (such as from a memcpy of a sub-object of a larger\nobject), we can split them up if there are non-integer components to the\naggregate hiding beneath. I've added the challenging test cases to\ndemonstrate how this is able to promote to scalars even a case where we\nhave even *partially* overlapping loads and stores.\n\nThis restores the single-store behavior for small arrays of i8s which is\nreally nice. I've restored both the little endian testing and big endian\ntesting for these exactly as they were prior to r225061. It also forced\nme to be more aggressive in an alignment test to actually defeat SROA.\n=] Without the added volatiles there, we actually split up the weird i16\nloads and produce nice double allocas with better alignment.\n\nThis also uncovered a number of bugs where we failed to handle\nsplittable load and store slices which didn't have a begininng offset of\nzero. Those fixes are included, and without them the existing test cases\nexplode in glorious fireworks. =]\n\nI've kept support for leaving whole-alloca integer loads and stores as\nsplittable even for the purpose of rewriting, but I think that's likely\nno longer needed. With the new pre-splitting, we might be able to remove\nall the splitting support for loads and stores from the rewriter. Not\ndoing that in this patch to try to isolate any performance regressions\nthat causes in an easy to find and revert chunk.","distinct":true,"url":"https://api.github.com/repos/chapuni/llvm-project/commits/dcda2349b1b6609ca0de92ecd099dd025f9c7d34"}]}