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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 22:57:02 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();
----------------
arsenm wrote:

Move this into the assert, unused variable. Or make onlyload in terms of PrevOnlyLoad (which isn't a great name either) 

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


More information about the llvm-commits mailing list