Index: lib/Analysis/CFLAliasAnalysis.cpp =================================================================== --- lib/Analysis/CFLAliasAnalysis.cpp +++ lib/Analysis/CFLAliasAnalysis.cpp @@ -209,8 +209,6 @@ void visitGetElementPtrInst(GetElementPtrInst &Inst) { auto *Op = Inst.getPointerOperand(); Output.push_back(Edge(&Inst, Op, EdgeType::Assign, AttrNone)); - for (auto I = Inst.idx_begin(), E = Inst.idx_end(); I != E; ++I) - Output.push_back(Edge(&Inst, *I, EdgeType::Assign, AttrNone)); } void visitSelectInst(SelectInst &Inst) { Index: test/Analysis/CFLAliasAnalysis/gep-index-no-alias.ll =================================================================== --- test/Analysis/CFLAliasAnalysis/gep-index-no-alias.ll +++ test/Analysis/CFLAliasAnalysis/gep-index-no-alias.ll @@ -0,0 +1,14 @@ +; This testcase ensures that gep result does not alias gep indices + +; RUN: opt < %s -disable-basicaa -cfl-aa -aa-eval -print-no-aliases -disable-output 2>&1 | FileCheck %s +; RUN: opt < %s -aa-pipeline=cfl-aa -passes=aa-eval -print-no-aliases -disable-output 2>&1 | FileCheck %s + +; CHECK: Function: foo +; CHECK: [2 x i32]* %a, [2 x i32]* %b +define void @foo(i32 %n) { + %a = alloca [2 x i32], align 4 + %b = alloca [2 x i32], align 4 + %c = getelementptr inbounds [2 x i32], [2 x i32]* %a, i32 0, i32 %n + %d = getelementptr inbounds [2 x i32], [2 x i32]* %b, i32 0, i32 %n + ret void +} \ No newline at end of file