brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · cb05a8e Raw
64 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=gvn -gvn-add-phi-translation=true  -S < %s | FileCheck %s --check-prefix=ADD-TRANS-ON --check-prefixes=CHECK,PT-ON-MDEP3; RUN: opt -passes='gvn<memoryssa>' -gvn-add-phi-translation=true  -S < %s | FileCheck %s --check-prefix=ADD-TRANS-ON --check-prefixes=CHECK,PT-ON-MSSA4; RUN: opt -passes=gvn -gvn-add-phi-translation=false -S < %s | FileCheck %s --check-prefix=ADD-TRANS-OFF --check-prefixes=CHECK,PT-OFF-MDEP5; RUN: opt -passes='gvn<memoryssa>' -gvn-add-phi-translation=false -S < %s | FileCheck %s --check-prefix=ADD-TRANS-OFF --check-prefixes=CHECK,PT-OFF-MSSA6 7; Test that phi translation is able to hoist a load whose address8; depends on an add also being hoisted.9define double @phi_translation_hoists_add(ptr %a, i64 %idx) {10; PT-ON-MDEP-LABEL: @phi_translation_hoists_add(11; PT-ON-MDEP-NEXT:  entry:12; PT-ON-MDEP-NEXT:    [[ADD_PHI_TRANS_INSERT:%.*]] = add nuw nsw i64 [[IDX:%.*]], 113; PT-ON-MDEP-NEXT:    [[GEP_PHI_TRANS_INSERT:%.*]] = getelementptr inbounds double, ptr [[A:%.*]], i64 [[ADD_PHI_TRANS_INSERT]]14; PT-ON-MDEP-NEXT:    [[LOAD_PRE:%.*]] = load double, ptr [[GEP_PHI_TRANS_INSERT]], align 815; PT-ON-MDEP-NEXT:    br label [[FOR_BODY:%.*]]16; PT-ON-MDEP:       for.body:17; PT-ON-MDEP-NEXT:    [[CMP:%.*]] = fcmp ole double [[LOAD_PRE]], 1.000000e+0018; PT-ON-MDEP-NEXT:    br i1 [[CMP]], label [[EXIT:%.*]], label [[FOR_BODY]]19; PT-ON-MDEP:       exit:20; PT-ON-MDEP-NEXT:    ret double [[LOAD_PRE]]21;22; PT-ON-MSSA-LABEL: @phi_translation_hoists_add(23; PT-ON-MSSA-NEXT:  entry:24; PT-ON-MSSA-NEXT:    br label [[FOR_BODY:%.*]]25; PT-ON-MSSA:       for.body:26; PT-ON-MSSA-NEXT:    [[ADD:%.*]] = add nuw nsw i64 [[IDX:%.*]], 127; PT-ON-MSSA-NEXT:    [[GEP:%.*]] = getelementptr inbounds double, ptr [[A:%.*]], i64 [[ADD]]28; PT-ON-MSSA-NEXT:    [[LOAD:%.*]] = load double, ptr [[GEP]], align 829; PT-ON-MSSA-NEXT:    [[CMP:%.*]] = fcmp ole double [[LOAD]], 1.000000e+0030; PT-ON-MSSA-NEXT:    br i1 [[CMP]], label [[EXIT:%.*]], label [[FOR_BODY]]31; PT-ON-MSSA:       exit:32; PT-ON-MSSA-NEXT:    ret double [[LOAD]]33;34; ADD-TRANS-OFF-LABEL: @phi_translation_hoists_add(35; ADD-TRANS-OFF-NEXT:  entry:36; ADD-TRANS-OFF-NEXT:    br label [[FOR_BODY:%.*]]37; ADD-TRANS-OFF:       for.body:38; ADD-TRANS-OFF-NEXT:    [[ADD:%.*]] = add nuw nsw i64 [[IDX:%.*]], 139; ADD-TRANS-OFF-NEXT:    [[GEP:%.*]] = getelementptr inbounds double, ptr [[A:%.*]], i64 [[ADD]]40; ADD-TRANS-OFF-NEXT:    [[LOAD:%.*]] = load double, ptr [[GEP]], align 841; ADD-TRANS-OFF-NEXT:    [[CMP:%.*]] = fcmp ole double [[LOAD]], 1.000000e+0042; ADD-TRANS-OFF-NEXT:    br i1 [[CMP]], label [[EXIT:%.*]], label [[FOR_BODY]]43; ADD-TRANS-OFF:       exit:44; ADD-TRANS-OFF-NEXT:    ret double [[LOAD]]45;46entry:47  br label %for.body48 49for.body:                                         ; preds = %for.body, %entry50  %add = add nuw nsw i64 %idx, 151  %gep = getelementptr inbounds double, ptr %a, i64 %add52  %load = load double, ptr %gep53  %cmp = fcmp ole double %load, 1.000000e+0054  br i1 %cmp, label %exit, label %for.body55 56exit:57  ret double %load58}59;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:60; ADD-TRANS-ON: {{.*}}61; CHECK: {{.*}}62; PT-OFF-MDEP: {{.*}}63; PT-OFF-MSSA: {{.*}}64