Correctly update return status for MVEGatherScatterLowering
authorserge-sans-paille <sguelton@redhat.com>
Thu, 9 Jul 2020 07:46:16 +0000 (09:46 +0200)
committerserge-sans-paille <sguelton@redhat.com>
Thu, 9 Jul 2020 09:18:54 +0000 (11:18 +0200)
`Changed` should reflect all possible changes.

Differential Revision: https://reviews.llvm.org/D83459

llvm/lib/Target/ARM/MVEGatherScatterLowering.cpp

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