diff options
author | Bill Wendling <isanbard@gmail.com> | 2008-05-14 22:45:20 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2008-05-14 22:45:20 +0000 |
commit | a6c3112b1f486922dcff71794cb9d96f17750648 (patch) | |
tree | 19cab41f8eb12d4141020413449ebff851a31dd7 /test/Transforms | |
parent | 6a33cc12ebf43b569ceea591c53edd3d507ad535 (diff) |
Situations can arise when you have a function called that returns a 'void', but
is bitcast to return a floating point value. The result of the instruction may
not be used by the program afterwards, and LLVM will happily remove all
instructions except the call. But, on some platforms, if a value is returned as
a floating point, it may need to be removed from the stack (like x87). Thus, we
can't get rid of the bitcast even if there isn't a use of the value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll | 3 | ||||
-rw-r--r-- | test/Transforms/InstCombine/fp-ret-bitcast.ll | 27 |
2 files changed, 28 insertions, 2 deletions
diff --git a/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll b/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll index 23fe07d2b3..b6930b5a65 100644 --- a/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll +++ b/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll @@ -3,7 +3,6 @@ declare void @free(i8*) define void @test(i32* %X) { - call i32 (...)* bitcast (void (i8*)* @free to i32 (...)*)( i32* %X ) ; <i32>:1 [#uses=0] + call void (...)* bitcast (void (i8*)* @free to void (...)*)( i32* %X ) ; <i32>:1 [#uses=0] ret void } - diff --git a/test/Transforms/InstCombine/fp-ret-bitcast.ll b/test/Transforms/InstCombine/fp-ret-bitcast.ll new file mode 100644 index 0000000000..00c1ea0b96 --- /dev/null +++ b/test/Transforms/InstCombine/fp-ret-bitcast.ll @@ -0,0 +1,27 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: grep {call float bitcast} | count 1 + %struct.NSObject = type { %struct.objc_class* } + %struct.NSArray = type { %struct.NSObject } + %struct.objc_class = type opaque + %struct.objc_selector = type opaque + +@"\01L_OBJC_METH_VAR_NAME_112" = internal global [15 x i8] c"whiteComponent\00", section "__TEXT,__cstring,cstring_literals" +@"\01L_OBJC_SELECTOR_REFERENCES_81" = internal global %struct.objc_selector* bitcast ([15 x i8]* @"\01L_OBJC_METH_VAR_NAME_112" to %struct.objc_selector*), section "__OBJC,__message_refs,literal_pointers,no_dead_strip" + +define void @bork() nounwind { +entry: + %color = alloca %struct.NSArray* + %color.466 = alloca %struct.NSObject* + %tmp103 = load %struct.NSArray** %color, align 4 + %tmp103104 = getelementptr %struct.NSArray* %tmp103, i32 0, i32 0 + store %struct.NSObject* %tmp103104, %struct.NSObject** %color.466, align 4 + %tmp105 = load %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_81", align 4 + %tmp106 = load %struct.NSObject** %color.466, align 4 + %tmp107 = call float bitcast (void (%struct.NSObject*, ...)* @objc_msgSend_fpret to float (%struct.NSObject*, %struct.objc_selector*)*)( %struct.NSObject* %tmp106, %struct.objc_selector* %tmp105 ) nounwind + br label %exit + +exit: + ret void +} + +declare void @objc_msgSend_fpret(%struct.NSObject*, ...) |