xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; This testcase was distilled from 132.ijpeg.  Bsaically we cannot fold the
2*9880d681SAndroid Build Coastguard Worker; load into the sub instruction here as it induces a cycle in the dag, which
3*9880d681SAndroid Build Coastguard Worker; is invalid code (there is no correct way to order the instruction).  Check
4*9880d681SAndroid Build Coastguard Worker; that we do not fold the load into the sub.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 | not grep sub.*GLOBAL
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker@GLOBAL = external global i32           ; <i32*> [#uses=1]
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine i32 @test(i32* %P1, i32* %P2, i32* %P3) nounwind {
11*9880d681SAndroid Build Coastguard Worker        %L = load i32, i32* @GLOBAL          ; <i32> [#uses=1]
12*9880d681SAndroid Build Coastguard Worker        store i32 12, i32* %P2
13*9880d681SAndroid Build Coastguard Worker        %Y = load i32, i32* %P3              ; <i32> [#uses=1]
14*9880d681SAndroid Build Coastguard Worker        %Z = sub i32 %Y, %L             ; <i32> [#uses=1]
15*9880d681SAndroid Build Coastguard Worker        ret i32 %Z
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18