fix: get llvm type of global val#128820
Conversation
This comment has been minimized.
This comment has been minimized.
|
cc @rust-lang/wg-llvm |
|
Could you add a test to show your change? |
I don't know how to make a test to show this change. this bug does not cause any compilation issues and they produce correct llvm ir . |
|
|
||
| let g = self.get_static_inner(def_id, val_llty); | ||
| let llty = self.val_ty(g); | ||
| let llty = llvm::LLVMGlobalGetValueType(g); |
There was a problem hiding this comment.
Can you please also adjust the self.val_ty(g) != self.type_ptr() check above? That one is also supposed to read LLVMGlobalGetValueType(g) != llty I believe.
There was a problem hiding this comment.
hm... i found the initializer type is always a packed struct(val_llty) at now. which can never be equal to the llty.
There was a problem hiding this comment.
why do we use cx.const_struct(&llvals, true) to create a packed const struct at const_alloc_to_llvm. can we create a normal struct for static initializer
There was a problem hiding this comment.
hm... i found the initializer type is always a
packed struct(val_ty) at now. which can never be equal to thellty.
But isn't this also the type we pass as llty? It's the type of the initializer v above, which should also be a packed struct?
There was a problem hiding this comment.
the llty is the type of old global var, which is set at predefine_static. and the val_llty is the type of initializer v.
the llty won't be a packed struct
|
r? nikic |
|
@bors r+ rollup |
fix: get llvm type of global val using `LLVMTypeOf` on a global var always return ptr. so create a new function to access the value type of a global
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#128820 (fix: get llvm type of global val) - rust-lang#129028 (`impl_trait_overcaptures`: Don't worry about uncaptured contravariant lifetimes if they outlive a captured lifetime) - rust-lang#129471 ([rustdoc] Sort impl associated items by kinds and then by appearance) - rust-lang#129706 (Rename dump of coroutine by-move-body to be more consistent, fix ICE in dump_mir) - rust-lang#129720 (Simplify DestProp memory management) - rust-lang#129796 (Unify scraped examples with other code examples) - rust-lang#129938 (Elaborate on deriving vs implementing `Copy`) - rust-lang#129973 (run_make_support: rename `Command::stdin` to `stdin_buf` and add `std{in,out,err}` config helpers) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#128820 (fix: get llvm type of global val) - rust-lang#129028 (`impl_trait_overcaptures`: Don't worry about uncaptured contravariant lifetimes if they outlive a captured lifetime) - rust-lang#129471 ([rustdoc] Sort impl associated items by kinds and then by appearance) - rust-lang#129706 (Rename dump of coroutine by-move-body to be more consistent, fix ICE in dump_mir) - rust-lang#129720 (Simplify DestProp memory management) - rust-lang#129796 (Unify scraped examples with other code examples) - rust-lang#129938 (Elaborate on deriving vs implementing `Copy`) - rust-lang#129973 (run_make_support: rename `Command::stdin` to `stdin_buf` and add `std{in,out,err}` config helpers) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128820 - LYF1999:yf/dev, r=nikic fix: get llvm type of global val using `LLVMTypeOf` on a global var always return ptr. so create a new function to access the value type of a global
using
LLVMTypeOfon a global var always return ptr. so create a new function to access the value type of a global