Skip to content

Commit dc6c25c

Browse files
committed
[FastISel] Fix the patchpoint intrinsic lowering in FastISel for large target addresses.
This fixes a mistake where I accidentially dropped the upper 32bit of a 64bit pointer during FastISel lowering of the patchpoint intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214367 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 450c33b commit dc6c25c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/CodeGen/SelectionDAG/FastISel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ bool FastISel::SelectPatchpoint(const CallInst *I) {
769769

770770
// Assume that the callee is a constant address or null pointer.
771771
// FIXME: handle function symbols in the future.
772-
unsigned CalleeAddr;
772+
uint64_t CalleeAddr;
773773
if (const auto *C = dyn_cast<IntToPtrInst>(Callee))
774774
CalleeAddr = cast<ConstantInt>(C->getOperand(0))->getZExtValue();
775775
else if (const auto *C = dyn_cast<ConstantExpr>(Callee)) {

test/CodeGen/X86/patchpoint.ll

+11-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ entry:
3939
ret void
4040
}
4141

42-
4342
; Test patchpoints reusing the same TargetConstant.
4443
; <rdar:15390785> Assertion failed: (CI.getNumArgOperands() >= NumArgs + 4)
4544
; There is no way to verify this, since it depends on memory allocation.
@@ -72,6 +71,17 @@ entry:
7271
ret void
7372
}
7473

74+
; Test large target address.
75+
define i64 @large_target_address_patchpoint_codegen() {
76+
entry:
77+
; CHECK-LABEL: large_target_address_patchpoint_codegen:
78+
; CHECK: movabsq $6153737369414576827, %r11
79+
; CHECK-NEXT: callq *%r11
80+
%resolveCall2 = inttoptr i64 6153737369414576827 to i8*
81+
%result = tail call i64 (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i64 2, i32 15, i8* %resolveCall2, i32 0)
82+
ret i64 %result
83+
}
84+
7585
declare void @llvm.experimental.stackmap(i64, i32, ...)
7686
declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
7787
declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)

0 commit comments

Comments
 (0)