[llvm] [LVI][ValueTracking] Take UB-implying attributes into account in `isSafeToSpeculativelyExecute` (PR #137604)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 01:01:15 PDT 2025


================
@@ -554,6 +554,20 @@ void Instruction::dropUBImplyingAttrsAndMetadata() {
   dropUBImplyingAttrsAndUnknownMetadata(KnownIDs);
 }
 
+bool Instruction::hasUBImplyingAttrs() const {
+  auto *CB = dyn_cast<CallBase>(this);
+  if (!CB)
+    return false;
+  // For call instructions, we also need to check parameter and return
+  // attributes that are can cause UB.
----------------
nikic wrote:

```suggestion
  // attributes that can cause UB.
```

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


More information about the llvm-commits mailing list