1; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 | FileCheck %s 2 3; BasicAA should detect NoAliases in PHIs and Selects. 4 5; CHECK: Function: foo 6; CHECK: NoAlias: double* %a, double* %b 7; CHECK: Function: bar 8; CHECK: NoAlias: double* %a, double* %b 9; CHECK: Function: qux 10; CHECK: NoAlias: double* %a, double* %b 11; CHECK: Function: fin 12; CHECK: NoAlias: double* %a, double* %b 13; CHECK: ===== Alias Analysis Evaluator Report ===== 14 15; Two PHIs in the same block. 16define void @foo(i1 %m, double* noalias %x, double* noalias %y) { 17entry: 18 br i1 %m, label %true, label %false 19 20true: 21 br label %exit 22 23false: 24 br label %exit 25 26exit: 27 %a = phi double* [ %x, %true ], [ %y, %false ] 28 %b = phi double* [ %x, %false ], [ %y, %true ] 29 store volatile double 0.0, double* %a 30 store volatile double 1.0, double* %b 31 ret void 32} 33 34; Two selects with the same condition. 35define void @bar(i1 %m, double* noalias %x, double* noalias %y) { 36entry: 37 %a = select i1 %m, double* %x, double* %y 38 %b = select i1 %m, double* %y, double* %x 39 store volatile double 0.000000e+00, double* %a 40 store volatile double 1.000000e+00, double* %b 41 ret void 42} 43 44; Two PHIs with disjoint sets of inputs. 45define void @qux(i1 %m, double* noalias %x, double* noalias %y, 46 i1 %n, double* noalias %v, double* noalias %w) { 47entry: 48 br i1 %m, label %true, label %false 49 50true: 51 br label %exit 52 53false: 54 br label %exit 55 56exit: 57 %a = phi double* [ %x, %true ], [ %y, %false ] 58 br i1 %n, label %ntrue, label %nfalse 59 60ntrue: 61 br label %nexit 62 63nfalse: 64 br label %nexit 65 66nexit: 67 %b = phi double* [ %v, %ntrue ], [ %w, %nfalse ] 68 store volatile double 0.0, double* %a 69 store volatile double 1.0, double* %b 70 ret void 71} 72 73; Two selects with disjoint sets of arms. 74define void @fin(i1 %m, double* noalias %x, double* noalias %y, 75 i1 %n, double* noalias %v, double* noalias %w) { 76entry: 77 %a = select i1 %m, double* %x, double* %y 78 %b = select i1 %n, double* %v, double* %w 79 store volatile double 0.000000e+00, double* %a 80 store volatile double 1.000000e+00, double* %b 81 ret void 82} 83