Patch fixes bugs in codegen for loops with unsigned counters and zero trip count. Previously preconditions for all loops were built using logic (Upper - Lower) > 0. But if the loop is a loop with zero trip count, then Upper - Lower is < 0 only for signed integer, for unsigned we're running into an underflow situation.
In this patch we're using original Lower<Upper condition to check that loop body can be executed at least once. Also this allows to skip code generation for loops, if it is known that preconditions for the loop are always false.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM.
lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
2386 ↗ | (On Diff #24002) | Cute, but more distracting than helpful. :) Maybe "Try to build LB <op> UB, where <op> is <, >, <=, or >=." |
Comment Actions
John, thanks for the review!
lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
2386 ↗ | (On Diff #24002) | John, thanks, I'll fix this. :) |