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

Issue39 #46

Merged
merged 7 commits into from
Feb 13, 2018
Merged

Issue39 #46

merged 7 commits into from
Feb 13, 2018

Conversation

neboat
Copy link
Collaborator

@neboat neboat commented Feb 9, 2018

These commits accomplish a few goals:

  • Restructure the Tapir lowering code to accommodate different implementations of the Cilk runtime system as targets. New code to target a new Cilk runtime will appear in a future PR.
  • Fix the Tapir lowering code to allow Tapir to compile the Cilk Plus runtime system, addressing issue Tapir fails to compile current CilkHub runtime #39. Regression tests are included for this issue.
  • Update Tapir-related code to work around a bug with older versions of GCC concerning handling of namespaces.

Accomplishing these goals involves similar changes to the codebase, which is why these commits address all three.

@@ -247,7 +247,7 @@ class StructType : public CompositeType {

/// Try to lookup a structure type by name, and create one if one does not
/// exist.
static StructType *getOrCreate(LLVMContext &Context, StringRef Name);
static StructType *lookupOrCreate(LLVMContext &Context, StringRef Name);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I was the one who initially added getOrCreate to this file. I'm confident that this method belongs in this file. But after reading the documentation about the other get methods in this file, I didn't feel comfortable continuing to use get in the name of this method. This change might not be strictly necessary, but I think it helps differentiate the semantics of this method from other methods with similar names.

@@ -25,7 +25,6 @@
#include "llvm/Transforms/Utils/ValueMapper.h"

namespace llvm {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a reason these things were moved from a tapir namespace? I'm personally leaning towards keeping it like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reorganizing the CilkABI code to deal with the first two goals, I observed that Tapir/LLVM would fail to build on old versions of GCC. The problem stems from a bug in how GCC handles namespaces. This GCC bug was not fixed until recently, i.e., GCC version 7. The workaround I found involves removing the Tapir namespace. Given that a lot of people who want to build Tapir still use older versions of GCC, I believe we need to accommodate those older GCC versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not clear on why the Tapir namespace was added in the first place. It seemed to be pushed to the codebase in a commit that never received review. It also added substantial clutter and redundancy to Tapir-related code and to parts of the codebase that interact with Tapir. Namespaces are used elsewhere in LLVM, but pretty sparingly, from what I see, and in ways that add clarity, not clutter. I don't feel the Tapir namespace accomplished that.

for (Function &F : M) {
if (F.getName() == "main")
WorkList.push_back(&F);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like a main-specific pass should be a separate function in TapirTarget

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is actually a bug fix to the Tapir lowering pass. Some Tapir targets already contain code that expects to see main among the functions to process. But if main itself did not contain a detach, then this routine in TapirToTarget would prevent those Tapir targets from properly process main, leading to incorrect behavior. We can separate out main-specific processing, but we'll need to fix some specific targets as well. I think that change makes sense to put in another PR.

@wsmoses wsmoses merged commit 118b768 into master Feb 13, 2018
@neboat neboat deleted the issue39 branch February 16, 2018 03:01
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.

None yet

2 participants