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

Kevin McAfee via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 09:50:45 PDT 2024


================
@@ -5225,7 +5225,10 @@ 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();
+
+  bool PrevOnlyLoad = HasChain && F->onlyReadsMemory();
----------------
kalxr wrote:

`PrevOnlyLoad` and the assert are temporary, I wanted to use the test infrastructure to find cases where `OnlyLoad` would have been `true` and will now be `false` after the addition of the willReturn check.

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


More information about the llvm-commits mailing list