Skip to content

Commit 7c5b7b6

Browse files
committed
Yup, calling LLVMIsTailCall on a non-CallInst is UB.
1 parent c2e2808 commit 7c5b7b6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/values/instruction_value.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,13 @@ impl<'ctx> InstructionValue<'ctx> {
182182
BasicBlock::new(value)
183183
}
184184

185-
// REVIEW: See if necessary to check opcode == Call first.
186-
// Does it always return false otherwise?
187185
pub fn is_tail_call(&self) -> bool {
188-
unsafe {
189-
LLVMIsTailCall(self.as_value_ref()) == 1
186+
if self.get_opcode() == InstructionOpcode::Call {
187+
unsafe {
188+
LLVMIsTailCall(self.as_value_ref()) == 1
189+
}
190+
} else {
191+
false
190192
}
191193
}
192194

0 commit comments

Comments
 (0)