OSDN Git Service

Revert r301880
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Mon, 1 May 2017 23:54:41 +0000 (23:54 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Mon, 1 May 2017 23:54:41 +0000 (23:54 +0000)
This change caused buildbot failures, apparently because we're not
passing around types that InstSimplify is used to seeing. I'm not overly
familiar with InstSimplify, so I'm reverting this until I can figure out
what exactly is wrong.

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

lib/Analysis/InstructionSimplify.cpp
test/Transforms/InstSimplify/select.ll

index 3137154..2f25a11 100644 (file)
@@ -62,8 +62,6 @@ static Value *SimplifyOrInst(Value *, Value *, const SimplifyQuery &, unsigned);
 static Value *SimplifyXorInst(Value *, Value *, const SimplifyQuery &, unsigned);
 static Value *SimplifyCastInst(unsigned, Value *, Type *,
                                const SimplifyQuery &, unsigned);
-static Value *SimplifyGEPInst(Type *, ArrayRef<Value *>, const SimplifyQuery &,
-                              unsigned);
 
 /// For a boolean type or a vector of boolean type, return false or a vector
 /// with every element false.
@@ -3493,17 +3491,6 @@ static const Value *SimplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp,
     }
   }
 
-  // Same for GEPs.
-  if (auto *GEP = dyn_cast<GetElementPtrInst>(I)) {
-    if (MaxRecurse) {
-      SmallVector<Value *, 8> NewOps(GEP->getNumOperands());
-      transform(GEP->operands(), NewOps.begin(),
-                [&](Value *V) { return V == Op ? RepOp : V; });
-      return SimplifyGEPInst(GEP->getSourceElementType(), NewOps, Q,
-                             MaxRecurse - 1);
-    }
-  }
-
   // TODO: We could hand off more cases to instsimplify here.
 
   // If all operands are constant after substituting Op for RepOp then we can
index 3e1af8c..cb2502c 100644 (file)
@@ -431,22 +431,3 @@ define i8 @do_not_assume_sel_cond(i1 %cond, i8 %x, i8 %y) {
   ret i8 %sel
 }
 
-define i32* @select_icmp_eq_0_gep_operand(i32* %base, i64 %n) {
-; CHECK-LABEL: @select_icmp_eq_0_gep_operand(
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr
-; CHECK-NEXT: ret i32* [[GEP]]
-  %cond = icmp eq i64 %n, 0
-  %gep = getelementptr i32, i32* %base, i64 %n
-  %r = select i1 %cond, i32* %base, i32* %gep
-  ret i32* %r
-}
-
-define i32* @select_icmp_ne_0_gep_operand(i32* %base, i64 %n) {
-; CHECK-LABEL: @select_icmp_ne_0_gep_operand(
-; CHECK-NEXT: [[GEP:%.*]] = getelementptr
-; CHECK-NEXT: ret i32* [[GEP]]
-  %cond = icmp ne i64 %n, 0
-  %gep = getelementptr i32, i32* %base, i64 %n
-  %r = select i1 %cond, i32* %gep, i32* %base
-  ret i32* %r
-}