Correctly update return status for MVEGatherScatterLowering

`Changed` should reflect all possible changes.

Differential Revision: https://reviews.llvm.org/D83459
This commit is contained in:
serge-sans-paille 2020-07-09 09:46:16 +02:00
parent dc4a6f5db4
commit e4ec6d0afe
1 changed files with 4 additions and 3 deletions

View File

@ -990,26 +990,27 @@ bool MVEGatherScatterLowering::runOnFunction(Function &F) {
SmallVector<IntrinsicInst *, 4> Gathers; SmallVector<IntrinsicInst *, 4> Gathers;
SmallVector<IntrinsicInst *, 4> Scatters; SmallVector<IntrinsicInst *, 4> Scatters;
bool Changed = false;
for (BasicBlock &BB : F) { for (BasicBlock &BB : F) {
for (Instruction &I : BB) { for (Instruction &I : BB) {
IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I); IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I);
if (II && II->getIntrinsicID() == Intrinsic::masked_gather) { if (II && II->getIntrinsicID() == Intrinsic::masked_gather) {
Gathers.push_back(II); Gathers.push_back(II);
if (isa<GetElementPtrInst>(II->getArgOperand(0))) if (isa<GetElementPtrInst>(II->getArgOperand(0)))
optimiseOffsets( Changed |= optimiseOffsets(
cast<Instruction>(II->getArgOperand(0))->getOperand(1), cast<Instruction>(II->getArgOperand(0))->getOperand(1),
II->getParent(), LI); II->getParent(), LI);
} else if (II && II->getIntrinsicID() == Intrinsic::masked_scatter) { } else if (II && II->getIntrinsicID() == Intrinsic::masked_scatter) {
Scatters.push_back(II); Scatters.push_back(II);
if (isa<GetElementPtrInst>(II->getArgOperand(1))) if (isa<GetElementPtrInst>(II->getArgOperand(1)))
optimiseOffsets( Changed |= optimiseOffsets(
cast<Instruction>(II->getArgOperand(1))->getOperand(1), cast<Instruction>(II->getArgOperand(1))->getOperand(1),
II->getParent(), LI); II->getParent(), LI);
} }
} }
} }
bool Changed = false;
for (unsigned i = 0; i < Gathers.size(); i++) { for (unsigned i = 0; i < Gathers.size(); i++) {
IntrinsicInst *I = Gathers[i]; IntrinsicInst *I = Gathers[i];
Value *L = lowerGather(I); Value *L = lowerGather(I);