[llvm] 403792f - [InstCombine] Add test for bitcast of unsized pointer (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 21 13:03:26 PDT 2021
Author: Nikita Popov
Date: 2021-06-21T22:03:15+02:00
New Revision: 403792f91e822e580dd5dc65ad80d0977d4fd9e3
URL: https://github.com/llvm/llvm-project/commit/403792f91e822e580dd5dc65ad80d0977d4fd9e3
DIFF: https://github.com/llvm/llvm-project/commit/403792f91e822e580dd5dc65ad80d0977d4fd9e3.diff
LOG: [InstCombine] Add test for bitcast of unsized pointer (NFC)
The bitcast should get folded into the select, but currently isn't
due to an incorrect early bailout.
Added:
Modified:
llvm/test/Transforms/InstCombine/bitcast.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/bitcast.ll b/llvm/test/Transforms/InstCombine/bitcast.ll
index 61e0327c0a33..9c509d969131 100644
--- a/llvm/test/Transforms/InstCombine/bitcast.ll
+++ b/llvm/test/Transforms/InstCombine/bitcast.ll
@@ -579,3 +579,16 @@ define i8* @bitcast_from_single_element_pointer_vector_to_pointer(<1 x i8*> %ptr
%ptr = bitcast <1 x i8*> %ptrvec to i8*
ret i8* %ptr
}
+
+declare void @f1()
+declare void @f2()
+define i8* @select_bitcast_unsized_pointer(i1 %c) {
+; CHECK-LABEL: @select_bitcast_unsized_pointer(
+; CHECK-NEXT: [[S:%.*]] = select i1 [[C:%.*]], void ()* @f1, void ()* @f2
+; CHECK-NEXT: [[B:%.*]] = bitcast void ()* [[S]] to i8*
+; CHECK-NEXT: ret i8* [[B]]
+;
+ %s = select i1 %c, void ()* @f1, void ()* @f2
+ %b = bitcast void ()* %s to i8*
+ ret i8* %b
+}
More information about the llvm-commits
mailing list