133b939c3SRoman Lebedev; RUN: opt -passes=consthoist -S < %s | FileCheck %s 2cee313d2SEric Christophertarget triple = "thumbv6m-none-eabi" 3cee313d2SEric Christopher 4cee313d2SEric Christopher%T = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 5cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 6cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 7cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 8cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 9cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 10cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 11cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 12cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 13cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 14cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 15cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 16cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 17cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 18cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 19cee313d2SEric Christopheri32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, 20cee313d2SEric Christopheri32, i32, i32, i32, i32, i32 } 21cee313d2SEric Christopher 22cd76f43bSDavid Green; Indices for GEPs should not be hoisted. 23*055fb779SNikita Popovdefine i32 @test1(ptr %P) nounwind { 24cee313d2SEric Christopher; CHECK-LABEL: @test1 25*055fb779SNikita Popov; CHECK: %addr1 = getelementptr %T, ptr %P, i32 256, i32 256 26*055fb779SNikita Popov; CHECK: %addr2 = getelementptr %T, ptr %P, i32 256, i32 256 27*055fb779SNikita Popov %addr1 = getelementptr %T, ptr %P, i32 256, i32 256 28*055fb779SNikita Popov %tmp1 = load i32, ptr %addr1 29*055fb779SNikita Popov %addr2 = getelementptr %T, ptr %P, i32 256, i32 256 30*055fb779SNikita Popov %tmp2 = load i32, ptr %addr2 31cee313d2SEric Christopher %tmp4 = add i32 %tmp1, %tmp2 32cee313d2SEric Christopher ret i32 %tmp4 33cee313d2SEric Christopher} 34cee313d2SEric Christopher 35