diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-06-17 17:47:24 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-17 17:47:24 +0000 |
| commit | 3370c20c7e3c21d487de1177a5b4e1e9971a8764 (patch) | |
| tree | 75acb9019bbeaf568ef0ef5d6c79eff9edb1b225 /clang/test/CodeGen/const-init.c | |
| parent | 9f86baebe06e77fac1174717b926fb99cfe092ef (diff) | |
| download | bcm5719-llvm-3370c20c7e3c21d487de1177a5b4e1e9971a8764.tar.gz bcm5719-llvm-3370c20c7e3c21d487de1177a5b4e1e9971a8764.zip | |
[CodeGen] Use pointer-sized integers for ptrtoint sources
Given something like:
void *v = (void *)100;
We need to synthesize a ptrtoint operation from 100. During constant
emission, we choose i64 as the type for our constant because it
guaranteed not to drop any bits from our CharUnits representation of the
value. However, this is suboptimal for 32-bit targets: LLVM passes like
GlobalOpt will get confused by these sorts of casts resulting in
pessimization.
Instead, make sure the ptrtoint operand has a pointer-sized integer
type.
llvm-svn: 273020
Diffstat (limited to 'clang/test/CodeGen/const-init.c')
| -rw-r--r-- | clang/test/CodeGen/const-init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/test/CodeGen/const-init.c b/clang/test/CodeGen/const-init.c index 9434f1d1b24..3fd231b630e 100644 --- a/clang/test/CodeGen/const-init.c +++ b/clang/test/CodeGen/const-init.c @@ -84,7 +84,7 @@ struct g13_s0 g13[] = { { (long) &g12_tmp } }; -// CHECK: @g14 = global i8* inttoptr (i64 100 to i8*) +// CHECK: @g14 = global i8* inttoptr (i32 100 to i8*) void *g14 = (void*) 100; // CHECK: @g15 = global i32 -1 |

