Issue 174375
Summary Lint pass should warn when fast math flags are used with noundef call return attribute
Labels good first issue, llvm:analysis
Assignees
Reporter arsenm
    This IR exhibits undefined behavior:
```
; RUN: opt -passes=lint %s

define float @noundef_with_fastmath_flags(float %x) {
  %result = call nnan noundef float @llvm.sqrt.f32(float %x)
  ret float %result
}
```

The sqrt will introduce poison if the input is negative or a nan due to the `nnan` flag. The lint utility pass should detect this anomaly and print a warning.

Probably need to introduce a cast to FPMathOperator, and check for poison generating flags around [here](https://github.com/llvm/llvm-project/blob/47fc1dd90ed4fa7c806795fada77e8c7cdfd6760/llvm/lib/Analysis/Lint.cpp#L214)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to