-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[CIR] Upstream handling of integral-to-pointer casts #161653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
eec6869
54e154c
2807388
d328d27
ec1ca90
2b3d7cb
9a9e05d
119873c
c321248
5866289
728ec84
142e70f
5324428
d5cd997
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,25 @@ void bitcast() { | |
|
||
// LLVM: %[[D_VEC:.*]] = load <2 x double>, ptr {{.*}}, align 16 | ||
// LLVM: %[[I_VEC:.*]] = bitcast <2 x double> %[[D_VEC]] to <4 x i32> | ||
|
||
void f(long int start) { | ||
void *p = (void*)start; | ||
} | ||
// CIR: %[[L:.*]] = cir.load {{.*}} : !cir.ptr<!s64i>, !s64i | ||
// CIR: %[[MID:.*]] = cir.cast integral %[[L]] : !s64i -> !u64i | ||
// CIR: cir.cast int_to_ptr %[[MID]] : !u64i -> !cir.ptr<!void> | ||
kimsh02 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
struct A { int x; }; | ||
|
||
void int_cast(long ptr) { | ||
((A *)ptr)->x = 0; | ||
} | ||
// CIR: cir.cast int_to_ptr {{.*}} : !u64i -> !cir.ptr<!rec_A> | ||
// LLVM: inttoptr {{.*}} to ptr | ||
|
||
void null_cast(long) { | ||
*(int *)0 = 0; | ||
((A *)0)->x = 0; | ||
} | ||
// CIR: #cir.ptr<null> : !cir.ptr<!s32i> | ||
// CIR: #cir.ptr<null> : !cir.ptr<!rec_A> | ||
|
Uh oh!
There was an error while loading. Please reload this page.