diff options
Diffstat (limited to 'mlir/lib/Target/LLVMIR/ModuleImport.cpp')
-rw-r--r-- | mlir/lib/Target/LLVMIR/ModuleImport.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp b/mlir/lib/Target/LLVMIR/ModuleImport.cpp index cff5a19..f24c277 100644 --- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp @@ -2263,10 +2263,15 @@ LogicalResult ModuleImport::convertInvokeAttributes(llvm::InvokeInst *inst, LogicalResult ModuleImport::convertCallAttributes(llvm::CallInst *inst, CallOp op) { setFastmathFlagsAttr(inst, op.getOperation()); + // Query the attributes directly instead of using `inst->getFnAttr(Kind)`, the + // latter does additional lookup to the parent and inherits, changing the + // semantics too early. + llvm::AttributeList callAttrs = inst->getAttributes(); + op.setTailCallKind(convertTailCallKindFromLLVM(inst->getTailCallKind())); - op.setConvergent(inst->isConvergent()); - op.setNoUnwind(inst->doesNotThrow()); - op.setWillReturn(inst->hasFnAttr(llvm::Attribute::WillReturn)); + op.setConvergent(callAttrs.getFnAttr(llvm::Attribute::Convergent).isValid()); + op.setNoUnwind(callAttrs.getFnAttr(llvm::Attribute::NoUnwind).isValid()); + op.setWillReturn(callAttrs.getFnAttr(llvm::Attribute::WillReturn).isValid()); llvm::MemoryEffects memEffects = inst->getMemoryEffects(); ModRefInfo othermem = convertModRefInfoFromLLVM( |