[PATCH] D34702: [DependenceAnalysis] Make sure base objects are the same when comparing GEPs

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 03:16:26 PDT 2017


philip.pfaffe added a comment.

The idea seems solid. Can you merge the testcases into one? If the testcase is named BasePtrBug, please also add the bug id, either in the name directly or in a comment inside.



================
Comment at: lib/Analysis/DependenceAnalysis.cpp:3340
     const SCEV *DstPtrSCEV = SE->getSCEV(DstGEP->getPointerOperand());
+    const SCEV *DiffSCEV = SE->getMinusSCEV(SrcPtrSCEV, DstPtrSCEV);
     DEBUG(dbgs() << "    SrcPtrSCEV = " << *SrcPtrSCEV << "\n");
----------------
Why did you choose to look at the difference instead of checking isKnownPredicate? Is there an advantage in looking at the difference? isKnownPredicate would communicate to the reader better the intention of this check.


================
Comment at: test/Analysis/DependenceAnalysis/BasePtrBug1.ll:4
+; Check that the dependence analysis generate the correct result when using
+; an aliased object that points to a difference element in the array.
+; void example_B(int *A, unsigned n) {
----------------
"generates" and "different"


https://reviews.llvm.org/D34702





More information about the llvm-commits mailing list