We don't have control/verify what will be the RHS of the division, so it might
happen to be zero, causing UB.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
427–429 | Do you really need it here? It does not check anything for casts. |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
414–415 | Does this cover the case where VL[0] is invalid? Maybe add a test for it? |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
427–429 | If that helper routine was checking for casts, I would have placed the call to it into the condition on line 426, similar to the check on line 414. But since it doesn't, there is no reason to do that there. On the other hand, if later some cast would become invalid, that condition on line 426 must be changed and the assert states exactly that. In other words, this assert verifies exactly that - the check does not list casts as invalid. |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
414–415 | I believe the second function in the LIT test verifies that - I have urem in the index 0 there. |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
386 | What about float point ops? |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
386 | FP subclasses of llvm::Instruction rely on default floating point environment, so shouldn't throw. If FP operation can produce a signaling NaN it should be represented as constrained intrinsic (via CallInst), which I doubt is handled in this file and should probably bailout for other reasons earlier. At least, I don't see calls to TLI->isFunctionVectorizable in this file. As such, I'm not aware of any existing issues in this regard. I'll be happy to update the code if you can point me which ones aren't valid and why. |
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
386 | I was just asking if you're sure about it - fine. |
This (and D72739) should be in 10.0 - please can you raise a bug and block https://bugs.llvm.org/show_bug.cgi?id=44555
Submitted https://bugs.llvm.org/show_bug.cgi?id=44559 and blocked https://bugs.llvm.org/show_bug.cgi?id=44555 with it.
What about float point ops?