[PATCH] D13040: [SimplifyCFG] Constant fold a branch implied by it's incoming edge
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 17:34:45 PDT 2015
reames created this revision.
reames added reviewers: hfinkel, sanjoy, majnemer, zhousheng00, spatel.
reames added a subscriber: llvm-commits.
The most common use case is when eliminating redundant range checks in an example like the following:
c = a[i+1] + a[i];
For the moment, the implies function only handles a single simple case. I plan to extend this function to handle more complex examples, but I wanted to separate a single transform based on it to make review easy. I'll also be implementing a profile guided version targeted at removing range checks in (a[i] + a[i+1]) as well. That will follow in a later patch.
In terms of code placement/testing, do folks think it would make sense to implement the implies function in InstructionSimplify? You can phrase an implication question as icmpa <= icmpb. Having it in InstSimpify would make it easier to test, but I'm not sure we actually want to start handling complex implications in InstSimplify. Thoughts?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4438 bytes
Desc: not available
More information about the llvm-commits