[llvm] [SDAG] Target intrinsics have chain if !WillReturn (PR #104819)
Kevin McAfee via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 10:42:05 PDT 2024
https://github.com/kalxr created https://github.com/llvm/llvm-project/pull/104819
An intrinsic is assumed to have side effects if it does not have the WillReturn attribute, so it should have a chain.
>From 83da843058cdec92bb20de50e8a1492d13c83dd6 Mon Sep 17 00:00:00 2001
From: Kevin McAfee <kmcafee at nvidia.com>
Date: Mon, 19 Aug 2024 10:38:51 -0700
Subject: [PATCH] [SDAG] Target intrinsics have chain if !WillReturn
---
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 60dcb118542785..06ea6e7f153670 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5232,7 +5232,7 @@ void SelectionDAGBuilder::visitTargetIntrinsic(const CallInst &I,
// readnone, but the lowering code will expect the chain based on the
// definition.
const Function *F = I.getCalledFunction();
- bool HasChain = !F->doesNotAccessMemory();
+ bool HasChain = !F->doesNotAccessMemory() || !F->willReturn();
bool OnlyLoad =
HasChain && F->onlyReadsMemory() && F->willReturn() && F->doesNotThrow();
More information about the llvm-commits
mailing list