[llvm] [SDAG] Read-only intrinsics must have WillReturn attribute to be treated as loads (PR #99999)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 02:35:02 PDT 2024


================
@@ -5229,7 +5229,7 @@ void SelectionDAGBuilder::visitTargetIntrinsic(const CallInst &I,
   // definition.
   const Function *F = I.getCalledFunction();
   bool HasChain = !F->doesNotAccessMemory();
-  bool OnlyLoad = HasChain && F->onlyReadsMemory();
+  bool OnlyLoad = HasChain && F->onlyReadsMemory() && F->willReturn();
----------------
nikic wrote:

Should probably also check `F->doesNotThrow()` for completeness?

https://github.com/llvm/llvm-project/pull/99999


More information about the llvm-commits mailing list