Index: test/CodeGen/Generic/inline-is-constant.ll =================================================================== --- /dev/null +++ test/CodeGen/Generic/inline-is-constant.ll @@ -0,0 +1,29 @@ +; RUN: opt -O3 < %s | lli +; +; Expected outcome: @fun is inlined and @llvm.is.constant is resolved to TRUE +; Without inlining @llvm.is.constant would resolve to FALSE. + +declare i1 @llvm.is.constant.i32(i32 %a) + +; Function Attrs: nounwind uwtable alwaysinline +define private i1 @fun(i32 %x) #0 { + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %value = load i32* %x.addr, align 4 + %const = call i1 @llvm.is.constant.i32(i32 %value) + ret i1 %const +} + +; Function Attrs: nounwind uwtable +define i32 @main() #1 { + %call = call i1 @fun(i32 127) + br i1 %call, label %IfTrue, label %IfFalse +IfTrue: + ret i32 0 +IfFalse: + ret i32 1 +} + +attributes #0 = { nounwind uwtable alwaysinline } + +attributes #1 = { nounwind uwtable }