Chris Lattner | f4946df | 2005-05-08 20:56:02 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | opt -reassociate -gcse -instcombine | llvm-dis | not grep add |
| 2 | |
| 3 | %a = weak global int 0 |
| 4 | %b = weak global int 0 |
| 5 | %c = weak global int 0 |
| 6 | %d = weak global int 0 |
| 7 | |
| 8 | implementation |
| 9 | |
| 10 | int %foo() { |
| 11 | %tmp.0 = load int* %a |
| 12 | %tmp.1 = load int* %b |
| 13 | %tmp.2 = add int %tmp.0, %tmp.1 ; (a+b) |
| 14 | %tmp.4 = load int* %c |
| 15 | %tmp.5 = add int %tmp.2, %tmp.4 ; (a+b)+c |
| 16 | %tmp.8 = add int %tmp.0, %tmp.4 ; (a+c) |
| 17 | %tmp.11 = add int %tmp.8, %tmp.1 ; (a+c)+b |
| 18 | %RV = xor int %tmp.5, %tmp.11 ; X ^ X = 0 |
| 19 | ret int %RV |
| 20 | } |