[PATCH] D36716: [LoopDataPrefetch][AArch64FalkorHWPFFix] Preserve ScalarEvolution

Geoff Berry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 14:55:52 PDT 2017


gberry created this revision.
Herald added subscribers: kristof.beyls, javed.absar, mzolotukhin, rengolin, aemerson.

Mark LoopDataPrefetch and AArch64FalkorHWPFFix passes as preserving
ScalarEvolution since they do not alter loop structure and should not
alter any SCEV values (though LoopDataPrefetch may introduce new
instructions that won't have cached SCEV values yet).

This can result in slight code differences, mainly w.r.t. nsw/nuw flags
on SCEVs, since these are computed somewhat lazily when a zext/sext
instruction is encountered.  As a result, passes after the modified
passes may see SCEVs with more nsw/nuw flags present.


https://reviews.llvm.org/D36716

Files:
  lib/Target/AArch64/AArch64FalkorHWPFFix.cpp
  lib/Transforms/Scalar/LoopDataPrefetch.cpp


Index: lib/Transforms/Scalar/LoopDataPrefetch.cpp
===================================================================
--- lib/Transforms/Scalar/LoopDataPrefetch.cpp
+++ lib/Transforms/Scalar/LoopDataPrefetch.cpp
@@ -120,9 +120,7 @@
     AU.addPreserved<LoopInfoWrapperPass>();
     AU.addRequired<OptimizationRemarkEmitterWrapperPass>();
     AU.addRequired<ScalarEvolutionWrapperPass>();
-    // FIXME: For some reason, preserving SE here breaks LSR (even if
-    // this pass changes nothing).
-    // AU.addPreserved<ScalarEvolutionWrapperPass>();
+    AU.addPreserved<ScalarEvolutionWrapperPass>();
     AU.addRequired<TargetTransformInfoWrapperPass>();
   }
 
Index: lib/Target/AArch64/AArch64FalkorHWPFFix.cpp
===================================================================
--- lib/Target/AArch64/AArch64FalkorHWPFFix.cpp
+++ lib/Target/AArch64/AArch64FalkorHWPFFix.cpp
@@ -92,9 +92,7 @@
     AU.addRequired<LoopInfoWrapperPass>();
     AU.addPreserved<LoopInfoWrapperPass>();
     AU.addRequired<ScalarEvolutionWrapperPass>();
-    // FIXME: For some reason, preserving SE here breaks LSR (even if
-    // this pass changes nothing).
-    // AU.addPreserved<ScalarEvolutionWrapperPass>();
+    AU.addPreserved<ScalarEvolutionWrapperPass>();
   }
 
   bool runOnFunction(Function &F) override;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36716.111080.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170814/5888c84c/attachment.bin>


More information about the llvm-commits mailing list