Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loop metadata: add two more test cases and improve loop discovery #1259

Closed
wants to merge 1 commit into from

Conversation

pawosm-arm
Copy link
Collaborator

Those two test cases were supposed to be contributed to PR #1094

Unfortunately, at that time, the -emit-flang-llvm flag was not supported by the frontend driver yet.

@pawosm-arm
Copy link
Collaborator Author

pawosm-arm commented Jun 9, 2022

Somehow downstream compiler is capable to find more loops than upstream.
Downstream (grep br):

        br label %L.LB1_352
        br i1 %3, label %L.LB1_324, label %L.LB1_323, !llvm.loop !23, !dbg !21
        br i1 %13, label %L.LB1_323, label %L.LB1_324, !llvm.loop !27, !dbg !26
        br i1 %15, label %L.LB1_327, label %L.LB1_326, !llvm.loop !30, !dbg !28
        br i1 %25, label %L.LB1_326, label %L.LB1_327, !llvm.loop !32, !dbg !35
        br i1 %28, label %L.LB1_330, label %L.LB1_329, !llvm.loop !37, !dbg !36
        br i1 %38, label %L.LB1_329, label %L.LB1_330, !llvm.loop !40, !dbg !39
        br i1 %41, label %L.LB1_333, label %L.LB1_332, !llvm.loop !43, !dbg !42
        br i1 %51, label %L.LB1_332, label %L.LB1_333, !llvm.loop !46, !dbg !45
        br i1 %54, label %L.LB1_336, label %L.LB1_335, !llvm.loop !49, !dbg !48
        br i1 %64, label %L.LB1_335, label %L.LB1_336, !llvm.loop !52, !dbg !51
        br i1 %67, label %L.LB1_339, label %L.LB1_338, !llvm.loop !54, !dbg !53
        br i1 %77, label %L.LB1_338, label %L.LB1_339, !llvm.loop !57, !dbg !56
        br label %L.LB1_317
        br i1 %81, label %L.LB1_342, label %L.LB1_341, !llvm.loop !59, !dbg !58
        br i1 %91, label %L.LB1_341, label %L.LB1_342, !llvm.loop !61, !dbg !62
        br label %L.LB1_320
        br i1 %94, label %L.LB1_345, label %L.LB1_344, !dbg !63
        br i1 %104, label %L.LB1_344, label %L.LB1_345, !llvm.loop !67, !dbg !66
        br i1 %107, label %L.LB1_348, label %L.LB1_347, !llvm.loop !69, !dbg !68
        br i1 %117, label %L.LB1_347, label %L.LB1_348, !llvm.loop !71, !dbg !72

Upstream (grep br), see !36:

        br label %L.LB1_352
        br i1 %3, label %L.LB1_324, label %L.LB1_323, !llvm.loop !23, !dbg !21
        br i1 %13, label %L.LB1_323, label %L.LB1_324, !llvm.loop !27, !dbg !26
        br i1 %15, label %L.LB1_327, label %L.LB1_326, !llvm.loop !30, !dbg !28
        br i1 %25, label %L.LB1_326, label %L.LB1_327, !llvm.loop !32, !dbg !35
        br i1 %28, label %L.LB1_330, label %L.LB1_329, !dbg !36
        br i1 %38, label %L.LB1_329, label %L.LB1_330, !llvm.loop !40, !dbg !39
        br i1 %41, label %L.LB1_333, label %L.LB1_332, !llvm.loop !43, !dbg !42
        br i1 %51, label %L.LB1_332, label %L.LB1_333, !llvm.loop !46, !dbg !45
        br i1 %54, label %L.LB1_336, label %L.LB1_335, !llvm.loop !49, !dbg !48
        br i1 %64, label %L.LB1_335, label %L.LB1_336, !llvm.loop !52, !dbg !51
        br i1 %67, label %L.LB1_339, label %L.LB1_338, !llvm.loop !54, !dbg !53
        br i1 %77, label %L.LB1_338, label %L.LB1_339, !llvm.loop !57, !dbg !56
        br label %L.LB1_317
        br i1 %81, label %L.LB1_342, label %L.LB1_341, !llvm.loop !59, !dbg !58
        br i1 %91, label %L.LB1_341, label %L.LB1_342, !llvm.loop !61, !dbg !62
        br label %L.LB1_320
        br i1 %94, label %L.LB1_345, label %L.LB1_344, !dbg !63
        br i1 %104, label %L.LB1_344, label %L.LB1_345, !llvm.loop !67, !dbg !66
        br i1 %107, label %L.LB1_348, label %L.LB1_347, !llvm.loop !69, !dbg !68
        br i1 %117, label %L.LB1_347, label %L.LB1_348, !llvm.loop !71, !dbg !72

Will be investigated later, PR frozen until then.

@pawosm-arm
Copy link
Collaborator Author

I've added a small code change which mitigates the problem

@pawosm-arm pawosm-arm changed the title test: add two more test cases for loop metadata loop metadata: add two more test cases and improve loop discovery Jun 9, 2022
@pawosm-arm
Copy link
Collaborator Author

I suspect cgmain changes aren't needed after rebase

Those two test cases were supposed to be contributed to PR flang-compiler#1094.
Unfortunately, at that time, the -emit-flang-llvm flag was not
supported by the frontend driver yet.

Signed-off-by: Paul Osmialowski <[email protected]>
@pawosm-arm
Copy link
Collaborator Author

These test cases are wrongly designed. With too many CHECK-DAG, the right occurrence of !llvm.loop is impossible to be found reliably (namely, a slight change in LLVM middle-end will break these test cases again). Therefore it's not worth to have them.

@pawosm-arm pawosm-arm closed this Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants