1; With sub reassociation, constant folding can eliminate the two 12 constants.
2;
3; RUN: opt < %s -reassociate -constprop -dce -S | not grep 12
4
5define i32 @test(i32 %A, i32 %B, i32 %C, i32 %D) {
6	%M = add i32 %A, 12		; <i32> [#uses=1]
7	%N = add i32 %M, %B		; <i32> [#uses=1]
8	%O = add i32 %N, %C		; <i32> [#uses=1]
9	%P = sub i32 %D, %O		; <i32> [#uses=1]
10	%Q = add i32 %P, 12		; <i32> [#uses=1]
11	ret i32 %Q
12}
13
14