Poison values

Hello,

I was trying to wrap my head around the poison semantic in llvm-ir.

Let say I have the following llvm ir:

int5 f(int5 %a) {
%b = lshr exact int5 %a, 2
%c = shl nuw int5 %a, 2
return %a
}

Even though I do not use %b nor %c, can I assume that %a is either 0 or 4?
That is, can I assume the creation of poison value is undefined behavior, or do I need to perform branching on posion value to actually have an undefined behavior?

Regards.

Hello,

I was trying to wrap my head around the poison semantic in llvm-ir.

Let say I have the following llvm ir:

int5 f(int5 %a) {
  %b = lshr exact int5 %a, 2
  %c = shl nuw int5 %a, 2
  return %a
}

Even though I do not use %b nor %c, can I assume that %a is either 0 or 4?
That is, can I assume the creation of poison value is undefined behavior

The creation of poison is not UB. Poison producing instructions can be
hoisted at-will.