[llvm-dev] [poison] is select-of-select to logic+select allowed?

David Menendez via llvm-dev llvm-dev at lists.llvm.org
Tue May 23 12:27:24 PDT 2017


On May 23, 2017, at 6:16 AM, Nuno Lopes via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
4) select removal
%c = icmp eq %x, C
%r = select %c, C, %x
  =>
%r = %x
<snip>
4) the example provided replaces C with %x in case %x=C. C is never poison, but %x might be.
<snip>
Summary table of what each transformation allows for %z = select %c, %x, %y. Each column is a different alternative of semantics for select:



UB if %c poison
+ conditional poison

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

Conditional poison
+ non-det choice if %c poison

Conditional poison + poison if %c poison**

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

SimplifyCFG

✓



✓

✓



Select->control-flow

✓

✓







Select->arithmetic



✓





✓

Select removal

✓

✓



✓

✓

Select hoist

✓

✓

✓





Easy movement





✓

✓

✓



Why doesn’t select removal work with the "Conditional poison + non-det choice if %c poison" case?

If %x is not poison, then %r is always equal to %x. If %x is poison, then %c is poison and %r is a non-deterministic choice between C (not poison) and %x (poison). So, I would think we can still replace %r with %x because poison is one of its possible behaviors.

--
Dave Menendez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170523/ba374099/attachment.html>


More information about the llvm-dev mailing list