[PATCH] D18305: [InstCombine] Ensure all undef operands are handled before binary instruction constant folding

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 15:06:25 PDT 2016


David Majnemer <david.majnemer at gmail.com> writes:
> majnemer accepted this revision.
> majnemer added a comment.
> This revision is now accepted and ready to land.
>
> LGTM with nits.
>
>
> ================
> Comment at: lib/IR/ConstantFold.cpp:1010-1011
> @@ -1001,1 +1009,4 @@
> +      return nullptr;
> +    case Instruction::BinaryOpsEnd:
> +      return nullptr;
>      }
> ----------------
> I'd make this `llvm_unreachable`.

Agreed, and this LGTM too.

It may be worth replacing the pattern of "BinaryOpsEnd = N+1" with a
"BinaryOpsLast = N" in the various Ops enums so that we don't need to do
this kind of silly trick in order to get fully covered switches. That
would make more sense as a follow up, obviously.


More information about the llvm-commits mailing list