Skip to content

Commit 4dce75f

Browse files
authored
Merge pull request #352 from rust-lang/update-libgccjit
Fix #[inline(always)] attribute and support unsigned comparison for signed integers
2 parents cf8c391 + e2f32c7 commit 4dce75f

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

Diff for: Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: doc/tests.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Tests
2+
3+
## Show the rustc command for UI tests
4+
5+
Add ` --test-args "--verbose"` to `./x.py test`.

Diff for: failing-ui-tests.txt

+1
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ tests/ui/lto/all-crates.rs
7171
tests/ui/async-await/deep-futures-are-freeze.rs
7272
tests/ui/closures/capture-unsized-by-ref.rs
7373
tests/ui/generator/resume-after-return.rs
74+
tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs

Diff for: src/attributes.rs

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ pub fn from_fn_attrs<'gcc, 'tcx>(
5353
codegen_fn_attrs.inline
5454
};
5555
if let Some(attr) = inline_attr(cx, inline) {
56+
if let FnAttribute::AlwaysInline = attr {
57+
func.add_attribute(FnAttribute::Inline);
58+
}
5659
func.add_attribute(attr);
5760
}
5861

Diff for: src/int.rs

+13
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
415415
IntPredicate::IntNE => {
416416
return self.context.new_comparison(None, ComparisonOp::NotEquals, cmp, self.context.new_rvalue_one(self.int_type));
417417
},
418+
// TODO(antoyo): cast to u128 for unsigned comparison. See below.
418419
IntPredicate::IntUGT => (ComparisonOp::Equals, 2),
419420
IntPredicate::IntUGE => (ComparisonOp::GreaterThanEquals, 1),
420421
IntPredicate::IntULT => (ComparisonOp::Equals, 0),
@@ -444,6 +445,18 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
444445
rhs = self.context.new_cast(None, rhs, a_type);
445446
}
446447
}
448+
match op {
449+
IntPredicate::IntUGT | IntPredicate::IntUGE | IntPredicate::IntULT | IntPredicate::IntULE => {
450+
if !a_type.is_vector() {
451+
let unsigned_type = a_type.to_unsigned(&self.cx);
452+
lhs = self.context.new_cast(None, lhs, unsigned_type);
453+
rhs = self.context.new_cast(None, rhs, unsigned_type);
454+
}
455+
},
456+
// TODO(antoyo): we probably need to handle signed comparison for unsigned
457+
// integers.
458+
_ => (),
459+
}
447460
self.context.new_comparison(None, op.to_gcc_comparison(), lhs, rhs)
448461
}
449462
}

0 commit comments

Comments
 (0)