diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-11-15 16:37:30 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-11-15 16:37:30 +0000 |
| commit | 956dec63fb4ea52877fb7bace0491b6ba437d186 (patch) | |
| tree | 667310280696cb6bdc8521a6b2f88fbc78aba96b /llvm/test/Transforms | |
| parent | 3e29890a7f5b4a9efaecb5884fb29ee87c8571fb (diff) | |
| download | bcm5719-llvm-956dec63fb4ea52877fb7bace0491b6ba437d186.tar.gz bcm5719-llvm-956dec63fb4ea52877fb7bace0491b6ba437d186.zip | |
[PassManager, SimplifyCFG] add test for PR34603 / D38566; NFC
This is a recommit of r316908 which was reverted by r317444.
llvm-svn: 318300
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/PhaseOrdering/simplifycfg-options.ll | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/Transforms/PhaseOrdering/simplifycfg-options.ll b/llvm/test/Transforms/PhaseOrdering/simplifycfg-options.ll index 90386e740e7..fcb9a552966 100644 --- a/llvm/test/Transforms/PhaseOrdering/simplifycfg-options.ll +++ b/llvm/test/Transforms/PhaseOrdering/simplifycfg-options.ll @@ -64,3 +64,43 @@ if.end: declare void @foo() +; PR34603 - https://bugs.llvm.org/show_bug.cgi?id=34603 +; We should have a select of doubles, not a select of double pointers. +; SimplifyCFG should not flatten this before early-cse has a chance to eliminate redundant ops. + +define double @max_of_loads(double* %x, double* %y, i64 %i) { +; ALL-LABEL: @max_of_loads( +; ALL-NEXT: entry: +; ALL-NEXT: [[XI_PTR:%.*]] = getelementptr double, double* [[X:%.*]], i64 [[I:%.*]] +; ALL-NEXT: [[YI_PTR:%.*]] = getelementptr double, double* [[Y:%.*]], i64 [[I]] +; ALL-NEXT: [[XI:%.*]] = load double, double* [[XI_PTR]], align 8 +; ALL-NEXT: [[YI:%.*]] = load double, double* [[YI_PTR]], align 8 +; ALL-NEXT: [[CMP:%.*]] = fcmp ogt double [[XI]], [[YI]] +; ALL-NEXT: [[Y_SINK:%.*]] = select i1 [[CMP]], double* [[X]], double* [[Y]] +; ALL-NEXT: [[YI_PTR_AGAIN:%.*]] = getelementptr double, double* [[Y_SINK]], i64 [[I]] +; ALL-NEXT: [[YI_AGAIN:%.*]] = load double, double* [[YI_PTR_AGAIN]], align 8 +; ALL-NEXT: ret double [[YI_AGAIN]] +; +entry: + %xi_ptr = getelementptr double, double* %x, i64 %i + %yi_ptr = getelementptr double, double* %y, i64 %i + %xi = load double, double* %xi_ptr + %yi = load double, double* %yi_ptr + %cmp = fcmp ogt double %xi, %yi + br i1 %cmp, label %if, label %else + +if: + %xi_ptr_again = getelementptr double, double* %x, i64 %i + %xi_again = load double, double* %xi_ptr_again + br label %end + +else: + %yi_ptr_again = getelementptr double, double* %y, i64 %i + %yi_again = load double, double* %yi_ptr_again + br label %end + +end: + %max = phi double [ %xi_again, %if ], [ %yi_again, %else ] + ret double %max +} + |

