We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c2e2808 + a2c3559 commit a937b23Copy full SHA for a937b23
src/values/instruction_value.rs
@@ -182,11 +182,14 @@ impl<'ctx> InstructionValue<'ctx> {
182
BasicBlock::new(value)
183
}
184
185
- // REVIEW: See if necessary to check opcode == Call first.
186
- // Does it always return false otherwise?
187
pub fn is_tail_call(&self) -> bool {
188
- unsafe {
189
- LLVMIsTailCall(self.as_value_ref()) == 1
+ // LLVMIsTailCall has UB if the value is not an llvm::CallInst*.
+ if self.get_opcode() == InstructionOpcode::Call {
+ unsafe {
+ LLVMIsTailCall(self.as_value_ref()) == 1
190
+ }
191
+ } else {
192
+ false
193
194
195
0 commit comments