[poison] re: is select-of-select to logic+select allowed ?

Nuno,
Sanjoy,
Can you provide some actual C source code examples that show how
End-to-end-miscompilations have resulted from the presence of “UB” in
Select statements ?

Thanks,
Peter Lawrence.

PS, IMHO “plain asci” isn’t that hard !

Summary table of what each transformation allows for
%z = select %c, %x, %y
Each column is a different alternative of semantics for select:

  1. UB if %c poison + conditional poison

  2. UB if %c poison + poison if either %x/%y poison

  3. Conditional poison + non-det choice if %c poison

  4. Conditional poison + poison if %c poison**

  5. Poison if any of %c/%x/%y are poison

option 1 2 3 4 5

SimplifyCFG ✓ . ✓ ✓ .

Select->control-flow ✓ ✓ . . .

Select->arithmetic . ✓ . . .

partially ✓ . . . .

Select removal ✓ ✓ ✓ ✓ ✓

Select hoist ✓ ✓ ✓ . .

Easy movement . . ✓ ✓ ✓

IMHO, the 3rd and 4th options are the ones that work best. Instructions with UB are usually a pain (for e.g. hoisting out o
f loops).

We hit an example of this recently. See
https://bugs.llvm.org/show_bug.cgi?id=34133

Dan,
        Many thanks for pointing this out,
Will look into it when back from vacation in Sept.
Peter Lawrence.