Chandler Carruth | 5da5343 | 2012-07-02 18:37:59 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -basicaa -aa-eval -print-all-alias-modref-info 2>&1 | FileCheck %s |
Dan Gohman | 776e4c8 | 2009-05-27 01:48:27 +0000 | [diff] [blame] | 2 | ; PR4267 |
| 3 | |
Ahmed Bougacha | a7e3311 | 2015-02-05 21:10:14 +0000 | [diff] [blame] | 4 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 5 | |
Michael Kruse | 47f8560 | 2017-06-21 18:25:37 +0000 | [diff] [blame] | 6 | ; CHECK: MayAlias: double* %p.0.i.0, double* %p3 |
Michael J. Spencer | 79833404 | 2010-08-30 15:08:02 +0000 | [diff] [blame] | 7 | |
Dan Gohman | 776e4c8 | 2009-05-27 01:48:27 +0000 | [diff] [blame] | 8 | ; %p3 is equal to %p.0.i.0 on the second iteration of the loop, |
Ahmed Bougacha | a7e3311 | 2015-02-05 21:10:14 +0000 | [diff] [blame] | 9 | ; so MayAlias is needed. In practice, basicaa returns PartialAlias |
| 10 | ; for GEPs to ignore TBAA. |
Dan Gohman | 776e4c8 | 2009-05-27 01:48:27 +0000 | [diff] [blame] | 11 | |
| 12 | define void @foo([3 x [3 x double]]* noalias %p) { |
| 13 | entry: |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 14 | %p3 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 0, i64 3 |
Dan Gohman | 776e4c8 | 2009-05-27 01:48:27 +0000 | [diff] [blame] | 15 | br label %loop |
| 16 | |
| 17 | loop: |
| 18 | %i = phi i64 [ 0, %entry ], [ %i.next, %loop ] |
| 19 | |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 20 | %p.0.i.0 = getelementptr [3 x [3 x double]], [3 x [3 x double]]* %p, i64 0, i64 %i, i64 0 |
Dan Gohman | 776e4c8 | 2009-05-27 01:48:27 +0000 | [diff] [blame] | 21 | |
Chris Lattner | 6a144a2 | 2011-11-27 06:54:59 +0000 | [diff] [blame] | 22 | store volatile double 0.0, double* %p3 |
| 23 | store volatile double 0.1, double* %p.0.i.0 |
Dan Gohman | 776e4c8 | 2009-05-27 01:48:27 +0000 | [diff] [blame] | 24 | |
| 25 | %i.next = add i64 %i, 1 |
| 26 | %cmp = icmp slt i64 %i.next, 3 |
| 27 | br i1 %cmp, label %loop, label %exit |
| 28 | |
| 29 | exit: |
| 30 | ret void |
| 31 | } |