[llvm-branch-commits] [InstCombine][asan] Don't speculate loads before `select ptr` (PR #100773)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 26 09:42:37 PDT 2024


================
@@ -1042,8 +1042,8 @@ Instruction *InstCombinerImpl::visitLoadInst(LoadInst &LI) {
   }
 
   // None of the following transforms are legal for volatile/ordered atomic
-  // loads.  Most of them do apply for unordered atomics.
-  if (!LI.isUnordered()) return nullptr;
+  // loads and sanitizers.  Most of them do apply for unordered atomics.
+  if (mustSuppressSpeculation(LI)) return nullptr;
----------------
nikic wrote:

Can we move this check to where it is relevant, i.e. the select fold in particular?

Also, should this check be inside isSafeToLoadUnconditionally maybe?

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


More information about the llvm-branch-commits mailing list