diff options
author | Jingyue Wu <jingyue@google.com> | 2015-04-14 04:59:22 +0000 |
---|---|---|
committer | Jingyue Wu <jingyue@google.com> | 2015-04-14 04:59:22 +0000 |
commit | 8cb6b2a292ea00b2a6d44ba60c5e8648ff71fe8e (patch) | |
tree | 8ecf80740d5dbe55de2a59c4094ede7c6bd4e7db /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 3996563428fdf75034a5026c33c5eaff52d8be51 (diff) | |
download | bcm5719-llvm-8cb6b2a292ea00b2a6d44ba60c5e8648ff71fe8e.tar.gz bcm5719-llvm-8cb6b2a292ea00b2a6d44ba60c5e8648ff71fe8e.zip |
Simplify n-ary adds by reassociation
Summary:
This transformation reassociates a n-ary add so that the add can partially reuse
existing instructions. For example, this pass can simplify
void foo(int a, int b) {
bar(a + b);
bar((a + 2) + b);
}
to
void foo(int a, int b) {
int t = a + b;
bar(t);
bar(t + 2);
}
saving one add instruction.
Fixes PR22357 (https://llvm.org/bugs/show_bug.cgi?id=22357).
Test Plan: nary-add.ll
Reviewers: broune, dberlin, hfinkel, meheff, sanjoy, atrick
Reviewed By: sanjoy, atrick
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D8950
llvm-svn: 234855
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
0 files changed, 0 insertions, 0 deletions