]> granicus.if.org Git - llvm/commitdiff
Revert r307581, "Avoid doing conservative phi checks in aliasSameBasePointerGEPs...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 11 Jul 2017 02:31:51 +0000 (02:31 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Tue, 11 Jul 2017 02:31:51 +0000 (02:31 +0000)
It broke stage2 tests in selfhosting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307613 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/BasicAliasAnalysis.h
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/ValueTracking.cpp

index ddc0a1aac53f3f5383bd22094b7455d4cee33c59..14e4bded264a9dbd52faafae1f88c7f4be2f2b42 100644 (file)
@@ -183,12 +183,6 @@ private:
                        uint64_t V2Size, const AAMDNodes &V2AAInfo,
                        const Value *UnderlyingV1, const Value *UnderlyingV2);
 
-  AliasResult aliasSameBasePointerGEPs(const GEPOperator *GEP1,
-                                       uint64_t V1Size,
-                                       const GEPOperator *GEP2,
-                                       uint64_t V2Size,
-                                       const DataLayout &DL);
-
   AliasResult aliasPHI(const PHINode *PN, uint64_t PNSize,
                        const AAMDNodes &PNAAInfo, const Value *V2,
                        uint64_t V2Size, const AAMDNodes &V2AAInfo,
index 758a907dde38bc5799255b6878b1ff367cf5be0f..b52a1d7b24d62fd9793220dd05333a4d5669911b 100644 (file)
@@ -922,11 +922,11 @@ ModRefInfo BasicAAResult::getModRefInfo(ImmutableCallSite CS1,
 
 /// Provide ad-hoc rules to disambiguate accesses through two GEP operators,
 /// both having the exact same pointer operand.
-AliasResult BasicAAResult::aliasSameBasePointerGEPs(const GEPOperator *GEP1,
-                                                    uint64_t V1Size,
-                                                    const GEPOperator *GEP2,
-                                                    uint64_t V2Size,
-                                                    const DataLayout &DL) {
+static AliasResult aliasSameBasePointerGEPs(const GEPOperator *GEP1,
+                                            uint64_t V1Size,
+                                            const GEPOperator *GEP2,
+                                            uint64_t V2Size,
+                                            const DataLayout &DL) {
 
   assert(GEP1->getPointerOperand()->stripPointerCastsAndBarriers() ==
              GEP2->getPointerOperand()->stripPointerCastsAndBarriers() &&
@@ -1006,7 +1006,7 @@ AliasResult BasicAAResult::aliasSameBasePointerGEPs(const GEPOperator *GEP1,
     // Because they cannot partially overlap and because fields in an array
     // cannot overlap, if we can prove the final indices are different between
     // GEP1 and GEP2, we can conclude GEP1 and GEP2 don't alias.
-
+    
     // If the last indices are constants, we've already checked they don't
     // equal each other so we can exit early.
     if (C1 && C2)
@@ -1014,15 +1014,11 @@ AliasResult BasicAAResult::aliasSameBasePointerGEPs(const GEPOperator *GEP1,
     {
       Value *GEP1LastIdx = GEP1->getOperand(GEP1->getNumOperands() - 1);
       Value *GEP2LastIdx = GEP2->getOperand(GEP2->getNumOperands() - 1);
-      if ((isa<PHINode>(GEP1LastIdx) || isa<PHINode>(GEP2LastIdx)) &&
-          !VisitedPhiBBs.empty()) {
+      if (isa<PHINode>(GEP1LastIdx) || isa<PHINode>(GEP2LastIdx)) {
         // If one of the indices is a PHI node, be safe and only use
         // computeKnownBits so we don't make any assumptions about the
         // relationships between the two indices. This is important if we're
         // asking about values from different loop iterations. See PR32314.
-        // But, with empty visitedPhiBBs we can guarantee that the values are
-        // from the same iteration. Therefore, we can avoid doing this
-        // conservative check.
         // TODO: We may be able to change the check so we only do this when
         // we definitely looked through a PHINode.
         if (GEP1LastIdx != GEP2LastIdx &&
index 704b5ebfa688ade97f4ef3cc8813bce921a6fdf6..9e042da8801dbd34e6e18ee5bfc9139c29112d47 100644 (file)
@@ -1873,7 +1873,7 @@ bool isKnownNonZero(const Value *V, unsigned Depth, const Query &Q) {
       if (Known.countMaxLeadingZeros() < BitWidth - ShiftVal)
         return true;
       // Are all the bits to be shifted out known zero?
-      if (Known.isUnknown() || Known.countMinTrailingZeros() >= ShiftVal)
+      if (Known.countMinTrailingZeros() >= ShiftVal)
         return isKnownNonZero(X, Depth, Q);
     }
   }