mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
BBVectorize: Add initial stores to the write set when tracking uses
When computing the use set of a store, we need to add the store to the write set prior to iterating over later instructions. Otherwise, if there is a later aliasing load of that store, that load will not be tagged as a use, and bad things will happen. trackUsesOfI still adds later dependent stores of an instruction to that instruction's write set, but it never sees the original instruction, and so when tracking uses of a store, the store must be added to the write set by the caller. Fixes PR16834. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188329 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1182,6 +1182,8 @@ namespace {
|
||||
// Look for an instruction with which to pair instruction *I...
|
||||
DenseSet<Value *> Users;
|
||||
AliasSetTracker WriteSet(*AA);
|
||||
if (I->mayWriteToMemory()) WriteSet.add(I);
|
||||
|
||||
bool JAfterStart = IAfterStart;
|
||||
BasicBlock::iterator J = llvm::next(I);
|
||||
for (unsigned ss = 0; J != E && ss <= Config.SearchLimit; ++J, ++ss) {
|
||||
@@ -1403,6 +1405,8 @@ namespace {
|
||||
|
||||
DenseSet<Value *> Users;
|
||||
AliasSetTracker WriteSet(*AA);
|
||||
if (I->mayWriteToMemory()) WriteSet.add(I);
|
||||
|
||||
for (BasicBlock::iterator J = llvm::next(I); J != E; ++J) {
|
||||
(void) trackUsesOfI(Users, WriteSet, I, J);
|
||||
|
||||
@@ -2804,6 +2808,8 @@ namespace {
|
||||
|
||||
DenseSet<Value *> Users;
|
||||
AliasSetTracker WriteSet(*AA);
|
||||
if (I->mayWriteToMemory()) WriteSet.add(I);
|
||||
|
||||
for (; cast<Instruction>(L) != J; ++L)
|
||||
(void) trackUsesOfI(Users, WriteSet, I, L, true, &LoadMoveSetPairs);
|
||||
|
||||
@@ -2824,6 +2830,8 @@ namespace {
|
||||
|
||||
DenseSet<Value *> Users;
|
||||
AliasSetTracker WriteSet(*AA);
|
||||
if (I->mayWriteToMemory()) WriteSet.add(I);
|
||||
|
||||
for (; cast<Instruction>(L) != J;) {
|
||||
if (trackUsesOfI(Users, WriteSet, I, L, true, &LoadMoveSetPairs)) {
|
||||
// Move this instruction
|
||||
@@ -2853,6 +2861,7 @@ namespace {
|
||||
|
||||
DenseSet<Value *> Users;
|
||||
AliasSetTracker WriteSet(*AA);
|
||||
if (I->mayWriteToMemory()) WriteSet.add(I);
|
||||
|
||||
// Note: We cannot end the loop when we reach J because J could be moved
|
||||
// farther down the use chain by another instruction pairing. Also, J
|
||||
|
Reference in New Issue
Block a user