133b939c3SRoman Lebedev; RUN: opt -S -passes=consthoist < %s | FileCheck %s 2cee313d2SEric Christopher 3cee313d2SEric Christophertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 4cee313d2SEric Christophertarget triple = "x86_64-apple-macosx10.9.0" 5cee313d2SEric Christopher 6cee313d2SEric Christopher%T = type { i32, i32, i32, i32 } 7cee313d2SEric Christopher 8cee313d2SEric Christopher; Test if even cheap base addresses are hoisted. 9cee313d2SEric Christopherdefine i32 @test1() nounwind { 10cee313d2SEric Christopher; CHECK-LABEL: @test1 11cee313d2SEric Christopher; CHECK: %const = bitcast i32 12345678 to i32 12*055fb779SNikita Popov; CHECK: %1 = inttoptr i32 %const to ptr 13*055fb779SNikita Popov; CHECK: %addr1 = getelementptr %T, ptr %1, i32 0, i32 1 14*055fb779SNikita Popov %addr1 = getelementptr %T, ptr inttoptr (i32 12345678 to ptr), i32 0, i32 1 15*055fb779SNikita Popov %tmp1 = load i32, ptr %addr1 16*055fb779SNikita Popov %addr2 = getelementptr %T, ptr inttoptr (i32 12345678 to ptr), i32 0, i32 2 17*055fb779SNikita Popov %tmp2 = load i32, ptr %addr2 18*055fb779SNikita Popov %addr3 = getelementptr %T, ptr inttoptr (i32 12345678 to ptr), i32 0, i32 3 19*055fb779SNikita Popov %tmp3 = load i32, ptr %addr3 20cee313d2SEric Christopher %tmp4 = add i32 %tmp1, %tmp2 21cee313d2SEric Christopher %tmp5 = add i32 %tmp3, %tmp4 22cee313d2SEric Christopher ret i32 %tmp5 23cee313d2SEric Christopher} 24cee313d2SEric Christopher 25