[PATCH] D60656: [LVI][CVP] Calculate with.overflow result range

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 15:21:48 PDT 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1083-1087
+  Instruction::BinaryOps BinOp;
+  switch (II->getIntrinsicID()) {
+    case Intrinsic::uadd_with_overflow:
+    case Intrinsic::sadd_with_overflow:
+      BinOp = Instruction::Add;
----------------
lebedev.ri wrote:
> This seems like a repetitive, emergent pattern.
> Would it make sense to add some function somewhere to return `std::pair<Instruction::BinaryOps, unsigned /*WrapType*/>` given `IntrinsicID`?
As we have quite a lot of code by now that has special handling for `with.overflow` intrinsics, it probably makes sense to create a `WithOverflowInst` subclass for them, that can hold these kind of helper methods.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60656/new/

https://reviews.llvm.org/D60656





More information about the llvm-commits mailing list