Chris Lattner | 08c7fd1 | 2005-08-10 00:48:11 +0000 | [diff] [blame] | 1 | ; Check that variable strides are reduced to adds instead of multiplies. |
Reid Spencer | 4dcf8bf | 2007-04-16 15:31:49 +0000 | [diff] [blame] | 2 | ; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | not grep mul |
Chris Lattner | 08c7fd1 | 2005-08-10 00:48:11 +0000 | [diff] [blame] | 3 | |
| 4 | declare bool %pred(int) |
| 5 | |
| 6 | void %test([10000 x int]* %P, int %STRIDE) { |
| 7 | br label %Loop |
| 8 | Loop: |
| 9 | %INDVAR = phi int [0, %0], [%INDVAR2, %Loop] |
| 10 | %Idx = mul int %INDVAR, %STRIDE |
| 11 | |
| 12 | %cond = call bool %pred(int %Idx) |
| 13 | %INDVAR2 = add int %INDVAR, 1 |
| 14 | br bool %cond, label %Loop, label %Out |
| 15 | Out: |
| 16 | ret void |
| 17 | } |