[llvm] Check for side effects when lowering target intrinsics, update NVVM ldu/ldg intrinsics with IntrWillReturn and test for DCE (PR #98968)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 20:54:25 PDT 2024


================
@@ -5227,7 +5227,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() && !I.mayHaveSideEffects();
----------------
arsenm wrote:

You shouldn't need to touch this. This is also a behavior change for callsite attributes, which will cause legalization failures for readnone callsites 

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


More information about the llvm-commits mailing list