bors
6fcb483609
auto merge of #6848 : pcwalton/rust/issue-6352, r=pcwalton
...
r? @nikomatsakis
2013-05-30 23:31:48 -07:00
Patrick Walton
40b455792d
librustc: Bump the offset when translating const structs. Closes #6352 .
2013-05-30 18:17:32 -07:00
Niko Matsakis
9c7eb068e5
Replace NDM with proper FIXME
2013-05-30 15:20:36 -04:00
Niko Matsakis
7a1a40890d
Remove copy bindings from patterns.
2013-05-30 15:20:36 -04:00
Niko Matsakis
5209709e46
Fix matching of rvalues with destructors
...
Fixes #4542 .
2013-05-30 15:20:36 -04:00
Niko Matsakis
c492a2126f
Remove some spurious copies that are identified by later patches
2013-05-30 09:54:39 -04:00
Niko Matsakis
7dfb865339
Remove local_imm/local_mem since all variables are now by reference
2013-05-30 09:54:38 -04:00
Niko Matsakis
2616581863
Refactor helper routines to be less tied to match syntax
2013-05-30 09:47:15 -04:00
Niko Matsakis
dcd84901c6
Remove TrByImplicitRef and source field on datums
2013-05-30 09:47:14 -04:00
Björn Steinbrink
1720d9f663
Remove a bunch of unnecessary allocations and copies
2013-05-30 11:49:04 +02:00
Patrick Walton
206ab89629
librustc: Stop reexporting the standard modules from prelude.
2013-05-29 19:04:53 -07:00
bors
844b5cff36
auto merge of #6794 : thestinger/rust/align_zero, r=pcwalton
...
This is unlikely to alter optimized codegen much but there's no point in downgrading the known alignment to 1.
2013-05-29 07:32:06 -07:00
bors
e3d0c1eb0e
auto merge of #6731 : thomaslee/rust/issue-6575, r=pcwalton
...
Fix for #6575 . In the trans phase, rustc emits code for a function parameter that goes completely unused in the event the return type of the function in question happens to be an immediate.
This patch modifies rustc & parts of rustrt to ensure that the vestigial parameter is no longer present in compiled code.
2013-05-28 17:37:57 -07:00
Daniel Micay
9ab2921300
use the type's alignment for generated memsets
2013-05-28 18:38:46 -04:00
bors
d7e1f08b21
auto merge of #6774 : alexcrichton/rust/silence-warnings, r=graydon
...
Also as a bonus this fixes #6767
2013-05-28 13:35:05 -07:00
Alex Crichton
b04c40bb1c
Silence various warnings throughout test modules
2013-05-28 15:27:35 -05:00
Daniel Micay
accc5272f8
noalias
on all &mut
parameters is too coarse
...
it can alias `&const` and `@mut`
2013-05-28 13:05:50 -04:00
bors
b738b5766e
auto merge of #6754 : thestinger/rust/noalias, r=nikomatsakis
...
The compiler guarantees that there are no other references to a unique pointer when it's passed by-value to a function.
The existence of the header and annihilator don't matter since it's not relevant to the call:
> For a call to the parent function, dependencies between memory references from before or after the call and from those during the call are “irrelevant” to the noalias keyword for the arguments and return value used in that call.
@graydon's tracing garbage collector stores the metadata outside of the boxes, so that won't be a problem. I'm unsure if updating the header while inside a function where it's marked as `noalias` would be a problem anyway since you never actually read or write to the header.
@nikomatsakis: r?
2013-05-28 02:59:03 -07:00
Tom Lee
b7f71e1ee6
Implementing suggestions from @nikomatsakis
2013-05-27 19:34:25 -07:00
bors
2061ce9aff
auto merge of #6741 : pcwalton/rust/intra-crate-start, r=graydon
...
r? @brson
2013-05-27 18:26:04 -07:00
Tom Lee
67283eaad2
Omit unused implicit argument if return type is immediate.
2013-05-27 17:13:01 -07:00
bors
dbc57584bd
auto merge of #6724 : thestinger/rust/swap_fast, r=thestinger
...
Passing higher alignment values gives the optimization passes more freedom since it can copy in larger chunks. This change results in rustc outputting the same post-optimization IR as clang for swaps and most copies excluding the lack of information about padding.
Code snippet:
```rust
#[inline(never)]
fn swap<T>(x: &mut T, y: &mut T) {
util::swap(x, y);
}
```
Original IR (for `int`):
```llvm
define internal fastcc void @_ZN9swap_283417_a71830ca3ed2d65d3_00E(i64*, i64*) #1 {
static_allocas:
%2 = icmp eq i64* %0, %1
br i1 %2, label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit, label %3
; <label>:3 ; preds = %static_allocas
%4 = load i64* %0, align 1
%5 = load i64* %1, align 1
store i64 %5, i64* %0, align 1
store i64 %4, i64* %1, align 1
br label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit
_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit: ; preds = %3, %static_allocas
ret void
}
```
After #6710 :
```llvm
define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 {
static_allocas:
%2 = load i64* %0, align 1
%3 = load i64* %1, align 1
store i64 %3, i64* %0, align 1
store i64 %2, i64* %1, align 1
ret void
}
```
After this change:
```llvm
define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 {
static_allocas:
%2 = load i64* %0, align 8
%3 = load i64* %1, align 8
store i64 %3, i64* %0, align 8
store i64 %2, i64* %1, align 8
ret void
}
```
Another example:
```rust
#[inline(never)]
fn set<T>(x: &mut T, y: T) {
*x = y;
}
```
Before, with `(int, int)` (align 1):
```llvm
define internal fastcc void @_ZN8set_282517_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 {
static_allocas:
%2 = bitcast { i64, i64 }* %1 to i8*
%3 = bitcast { i64, i64 }* %0 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 1, i1 false)
ret void
}
```
After, with `(int, int)` (align 8):
```llvm
define internal fastcc void @_ZN8set_282617_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 {
static_allocas:
%2 = bitcast { i64, i64 }* %1 to i8*
%3 = bitcast { i64, i64 }* %0 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 8, i1 false)
ret void
}
```
2013-05-27 15:56:08 -07:00
Seo Sanghyeon
8f80323f09
Remove unnecessary allocations flagged by lint
2013-05-28 03:14:44 +09:00
Daniel Micay
c302010ef0
mark unique pointer parameters as noalias
...
Closes #6749
2013-05-26 14:11:30 -04:00
Daniel Micay
58d6864ad7
add an align parameter to call_memcpy
2013-05-26 10:26:04 -04:00
Daniel Micay
d9c0f0f188
add memset32/memset64
2013-05-26 10:26:03 -04:00
Daniel Micay
cf8e9f9aec
make the memcpy/memmove intrinsics higher-level
...
This allows them to make use of the type's alignment, instead of being
pessimistic and assuming it is only 1.
2013-05-26 10:26:03 -04:00
James Miller
2c2346e3d4
Mark &mut parameters as noalias
2013-05-26 17:40:07 +12:00
Patrick Walton
cf34f9f9a9
librustc: Allow intra-crate start functions, for runtimeless operation.
2013-05-25 18:20:33 -07:00
bors
ed9a793d24
auto merge of #6706 : brson/rust/glue, r=catamorphism
...
Instead of `glue_drop1234` it's `Type::<hash>::glue_drop1234`
Haven't done any performance testing.
2013-05-23 23:13:46 -07:00
bors
212d6a2f61
auto merge of #6710 : thestinger/rust/swap, r=catamorphism
2013-05-23 22:04:40 -07:00
Daniel Micay
7d2f836065
add memcpy intrinsic to mirror memmove
2013-05-23 22:29:30 -04:00
bors
a776d65b4d
auto merge of #6690 : erickt/rust/cleanup-warnings, r=brson
...
Simple patch series to fix up all the warnings a rustc compile is giving at the moment. It also fixes a NOTE in `to_bytes.rs` to remove the `to_bytes::iter_bytes_<N>` functions.
2013-05-23 18:10:36 -07:00
Erick Tryzelaar
9635b30837
cleanup warnings from librustc
2013-05-23 17:57:07 -07:00
Erick Tryzelaar
1965d72957
core: remove iter_bytes helper functions
2013-05-23 17:48:16 -07:00
Brian Anderson
7f642f3d85
rustc: Give glue symbols meaningful names
...
Instead of `glue_drop1234` it's `Type::<hash>::glue_drop1234`
Haven't done any performance testing.
2013-05-23 17:01:45 -07:00
Brian Anderson
d213443a67
rustc: Check for null before dropping ~objects. #5192
2013-05-23 15:33:34 -07:00
Patrick Walton
c532e033c9
librustc: Change std
to extra
throughout libsyntax and librustc
2013-05-22 21:57:08 -07:00
Patrick Walton
f3723cf7c4
libextra: Rename the actual metadata names of libcore to libstd and libstd to libextra
2013-05-22 21:57:07 -07:00
Patrick Walton
211d038abc
librustc: Make ~Trait
two words by storing the type descriptor in the vtable.
2013-05-22 21:57:03 -07:00
Patrick Walton
08e561ae70
librustc: Disable borrow check debugging even when rustc is compiled with -O0.
...
This improves -O0 compile times dramatically.
2013-05-22 21:57:02 -07:00
bors
1d3e84c5d6
auto merge of #6669 : yjh0502/rust/fix_6209, r=graydon
...
Fix issue #6209 , and some related issues about constant expression
- unmatched type between arms
- unmatched type in range
2013-05-22 18:01:36 -07:00
Corey Richardson
e64339645b
Implement static_assert attribute
...
This verifies that a static item evaluates to true, at compile time.
2013-05-22 13:13:24 -04:00
Jihyun Yu
f8af2b50ee
fix issue #6209
2013-05-22 14:06:25 +09:00
Tim Chevalier
8c68c4a52c
rustc: Don't generate code for unreachable expressions
...
The way we deal with unreachable expressions in trans is pretty ad hoc,
but this at least doesn't make it worse, and eliminates the LLVM
assertion failure reported in #5741 .
2013-05-21 13:15:48 -07:00
bors
5a3e320514
auto merge of #6647 : alexcrichton/rust/unnecessary-alloc, r=graydon
...
This adds a lint mode for detecting unnecessary allocations on the heap. This isn't super fancy, currently it only has two rules
1. For a function's arguments, if you allocate a `[~|@]str` literal, when the type of the argument is a `&str`, emit a warning.
2. For the same case, emit warnings for boxed vectors when slices are required.
After adding the lint, I rampaged through the libraries and removed all the unnecessary allocations I could find.
2013-05-20 23:55:20 -07:00
Brian Anderson
474d9983be
rustllvm: Use target alignment for atomic load/store
2013-05-20 17:28:06 -07:00
Alex Crichton
82fa0018c8
Remove all unnecessary allocations (as flagged by lint)
2013-05-20 16:10:40 -05:00
bors
2e6cda254a
auto merge of #6635 : brson/rust/snapshot, r=brson
2013-05-20 02:46:36 -07:00
bors
ab46a38039
auto merge of #6632 : steveklabnik/rust/remove_more_warnings, r=thestinger
...
With this, the build is almost 100% warning free.
One more can be fixed after the next snapshot, and there's one other that I filed an issue about already.
2013-05-20 01:37:39 -07:00