[PATCH] D20775: [CFLAA] Remove redundant aliasing relation between GEP indices and GEP result

Jia Chen via llvm-commits llvm-commits at lists.llvm.org
Mon May 30 13:46:32 PDT 2016


grievejia updated this revision to Diff 58994.
grievejia added a comment.

Added test case


http://reviews.llvm.org/D20775

Files:
  lib/Analysis/CFLAliasAnalysis.cpp
  test/Analysis/CFLAliasAnalysis/gep-index-no-alias.ll

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
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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20775.58994.patch
Type: text/x-patch
Size: 1451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160530/ed777d9f/attachment.bin>


More information about the llvm-commits mailing list