45 lines · plain
1;2; Test: ExternalConstant3;4; Description:5; This regression test helps check whether the instruction combining6; optimization pass correctly handles global variables which are marked7; as external and constant.8;9; If a problem occurs, we should die on an assert(). Otherwise, we10; should pass through the optimizer without failure.11;12; Extra code:13; RUN: opt < %s -passes=instcombine14; END.15 16target datalayout = "e-p:32:32"17@silly = external constant i32 ; <ptr> [#uses=1]18 19declare void @bzero(ptr, i32)20 21declare void @bcopy(ptr, ptr, i32)22 23declare i32 @bcmp(ptr, ptr, i32)24 25declare i32 @fputs(ptr, ptr)26 27declare i32 @fputs_unlocked(ptr, ptr)28 29define i32 @function(i32 %a.1) {30entry:31 %a.0 = alloca i32 ; <ptr> [#uses=2]32 %result = alloca i32 ; <ptr> [#uses=2]33 store i32 %a.1, ptr %a.034 %tmp.0 = load i32, ptr %a.0 ; <i32> [#uses=1]35 %tmp.1 = load i32, ptr @silly ; <i32> [#uses=1]36 %tmp.2 = add i32 %tmp.0, %tmp.1 ; <i32> [#uses=1]37 store i32 %tmp.2, ptr %result38 br label %return39 40return: ; preds = %entry41 %tmp.3 = load i32, ptr %result ; <i32> [#uses=1]42 ret i32 %tmp.343}44 45