File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
lib/Transforms/InstCombine
test/Transforms/InstCombine Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2202,6 +2202,11 @@ Instruction *InstCombinerImpl::visitPtrToInt(PtrToIntInst &CI) {
22022202 return commonCastTransforms (CI);
22032203}
22042204
2205+ Instruction *InstCombinerImpl::visitPtrToAddr (PtrToAddrInst &CI) {
2206+ // FIXME: Implement variants of ptrtoint folds.
2207+ return commonCastTransforms (CI);
2208+ }
2209+
22052210// / This input value (which is known to have vector type) is being zero extended
22062211// / or truncated to the specified vector type. Since the zext/trunc is done
22072212// / using an integer type, we have a (bitcast(cast(bitcast))) pattern,
Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
143143 Instruction *visitUIToFP (CastInst &CI);
144144 Instruction *visitSIToFP (CastInst &CI);
145145 Instruction *visitPtrToInt (PtrToIntInst &CI);
146+ Instruction *visitPtrToAddr (PtrToAddrInst &CI);
146147 Instruction *visitIntToPtr (IntToPtrInst &CI);
147148 Instruction *visitBitCast (BitCastInst &CI);
148149 Instruction *visitAddrSpaceCast (AddrSpaceCastInst &CI);
Original file line number Diff line number Diff line change @@ -10,8 +10,18 @@ target datalayout = "pe1:64:64:64:32"
1010@g.as1 = external addrspace (1 ) global i8
1111@g2.as1 = external addrspace (1 ) global i8
1212
13- define i32 @ptrtoaddr_inttoptr_arg (i32 %a ) {
14- ; CHECK-LABEL: define i32 @ptrtoaddr_inttoptr_arg(
13+ define i64 @ptrtoaddr_inttoptr_arg (i64 %a ) {
14+ ; CHECK-LABEL: define i64 @ptrtoaddr_inttoptr_arg(
15+ ; CHECK-SAME: i64 [[A:%.*]]) {
16+ ; CHECK-NEXT: ret i64 [[A]]
17+ ;
18+ %toptr = inttoptr i64 %a to ptr
19+ %toaddr = ptr toaddr ptr %toptr to i64
20+ ret i64 %toaddr
21+ }
22+
23+ define i32 @ptrtoaddr_inttoptr_arg_addrsize (i32 %a ) {
24+ ; CHECK-LABEL: define i32 @ptrtoaddr_inttoptr_arg_addrsize(
1525; CHECK-SAME: i32 [[A:%.*]]) {
1626; CHECK-NEXT: [[TMP1:%.*]] = zext i32 [[A]] to i64
1727; CHECK-NEXT: [[TOPTR:%.*]] = inttoptr i64 [[TMP1]] to ptr addrspace(1)
You can’t perform that action at this time.
0 commit comments