[PATCH] D46343: [CFLGraph] Fixed Select instruction handling

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 2 03:29:06 PDT 2018


xbolva00 updated this revision to Diff 144845.
xbolva00 added a comment.

Added test case


https://reviews.llvm.org/D46343

Files:
  lib/Analysis/CFLGraph.h
  test/Analysis/CFLAliasAnalysis/Andersen/select.ll


Index: test/Analysis/CFLAliasAnalysis/Andersen/select.ll
===================================================================
--- test/Analysis/CFLAliasAnalysis/Andersen/select.ll
+++ test/Analysis/CFLAliasAnalysis/Andersen/select.ll
@@ -0,0 +1,12 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -disable-basicaa -cfl-anders-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+; RUN: opt < %s -aa-pipeline=cfl-anders-aa -passes=aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s
+
+
+; CHECK-LABEL: Function: test_select
+; CHECK: MayAlias:	i8* %val1, i8* %val2
+define void @test_select(i8* %val1, i8* %val2) {
+  select i1 true, i8* %val1, i8* %val2
+  ret void
+}
+
Index: lib/Analysis/CFLGraph.h
===================================================================
--- lib/Analysis/CFLGraph.h
+++ lib/Analysis/CFLGraph.h
@@ -541,6 +541,12 @@
         break;
       }
 
+      case Instruction::Select: {
+        addAssignEdge(CE->getOperand(1), CE);
+        addAssignEdge(CE->getOperand(2), CE);
+        break;
+      }
+
       case Instruction::InsertElement:
       case Instruction::InsertValue: {
         addAssignEdge(CE->getOperand(0), CE);
@@ -573,7 +579,6 @@
       case Instruction::AShr:
       case Instruction::ICmp:
       case Instruction::FCmp:
-      case Instruction::Select:
       case Instruction::ShuffleVector: {
         addAssignEdge(CE->getOperand(0), CE);
         addAssignEdge(CE->getOperand(1), CE);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46343.144845.patch
Type: text/x-patch
Size: 1531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180502/784c4af2/attachment.bin>


More information about the llvm-commits mailing list