[PATCH] D59071: [Transform] Improve saddo with mixed signs

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 04:29:33 PST 2019


nikic added a comment.

Generally I feel that the optimization we want to go for here is a more general one. We already detect always/never overflow conditions based on known bits. This is a variation that detects never overflow based on the constant range of the input, for one specific case. We have generic code in InstructionSimplify to determine the ConstantRange of binary operators and intrinsics (setLimitsForBinOp and setLimitsForIntrinsic) for cases where this can be done cheaply (inspecting only one instruction).

I'm thinking that we should generalize that code to take any Instruction, move it as an exported API into ValueTracking and then do a generic ConstantRange based always/never overflow check here. Does that sound reasonable @spatel?


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

https://reviews.llvm.org/D59071





More information about the llvm-commits mailing list