Handle the case where the or disjoint
folds immediately to a constant
This commit is contained in:
parent
5e6ae8bb5c
commit
f46e6be190
2 changed files with 18 additions and 2 deletions
|
@ -424,7 +424,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
fn or_disjoint(&mut self, a: &'ll Value, b: &'ll Value) -> &'ll Value {
|
||||
unsafe {
|
||||
let or = llvm::LLVMBuildOr(self.llbuilder, a, b, UNNAMED);
|
||||
llvm::LLVMSetIsDisjoint(or, True);
|
||||
|
||||
// If a and b are both values, then `or` is a value, rather than
|
||||
// an instruction, so we need to check before setting the flag.
|
||||
// (See also `LLVMBuildNUWNeg` which also needs a check.)
|
||||
if llvm::LLVMIsAInstruction(or).is_some() {
|
||||
llvm::LLVMSetIsDisjoint(or, True);
|
||||
}
|
||||
or
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue