[PATCH] D22942: [SCEV] Fix runtime error caused by ValueOffsetPair

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 18:35:40 PDT 2016


sanjoy requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: include/llvm/Analysis/ScalarEvolutionExpander.h:283
@@ +282,3 @@
+    /// into the IR.
+    Value *findExistingExpansion(const SCEV *S, const Instruction *At, Loop *L,
+                                 bool OnlyCheckIsNull = true);
----------------
Hi Wei,

I'm not sure this is the best interface -- it still is too easy to make mistakes.  I think there should be two entry points here (which can share code as appropriate):

 - `Value *getExactExistingExpansion` : if this returns non-null, then we know that the return value is the exact expansion.  We'll use this in IndVarSimplify (and potentially other places that don't want to generate additional code).

 - `Optional<ValueOffsetPair> getRelatedExistingExpansion`: if this returns non- `None`, then we know we can codegen the `ValueOffsetPair` into a suitable expansion.

The first can be implemented in terms of the latter.


Repository:
  rL LLVM

https://reviews.llvm.org/D22942





More information about the llvm-commits mailing list