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

Apply a forgotten patch to LLVM >3.9 #25537

Merged
merged 1 commit into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# treat patches as files that should not be modified
*.patch -text
Copy link
Member

Choose a reason for hiding this comment

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

can we just do * -text to prevent git from ever munging files? (similar to what we suggest at https://github.com/JuliaLang/julia/blob/master/README.windows.md#line-endings)?

Copy link
Member Author

Choose a reason for hiding this comment

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

isn't that different? we suggest eol=lf and autocrlf=input, while -text implies no autocrlf at all (potentially introducing crlf line endings)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @maleadt is right here. I have another attempt at this in #27291 that might achieve the intended thing, though.

2 changes: 2 additions & 0 deletions deps/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ $(eval $(call LLVM_PATCH,llvm-D32208-coerce-non-integral)) # Remove for 5.0
$(eval $(call LLVM_PATCH,llvm-D32623-GVN-non-integral)) # Remove for 5.0
$(eval $(call LLVM_PATCH,llvm-D33129-scevexpander-non-integral)) # Remove for 5.0
$(eval $(call LLVM_PATCH,llvm-Yet-another-fix))
$(eval $(call LLVM_PATCH,llvm-NVPTX-addrspaces)) # NVPTX
$(eval $(call LLVM_PATCH,llvm-4.0.0-D37576-NVPTX-sm_70)) # NVPTX, Remove for 6.0
$(eval $(call LLVM_PATCH,llvm-loadcse-addrspace_4.0))
ifeq ($(BUILD_LLVM_CLANG),1)
Expand All @@ -496,6 +497,7 @@ $(eval $(call LLVM_PATCH,llvm-3.9.0_D27296-libssp))
$(eval $(call LLVM_PATCH,llvm-D27629-AArch64-large_model_4.0))
$(eval $(call LLVM_PATCH,llvm-loadcse-addrspace_5.0))
$(eval $(call LLVM_PATCH,llvm-D34078-vectorize-fdiv))
$(eval $(call LLVM_PATCH,llvm-5.0-NVPTX-addrspaces)) # NVPTX
$(eval $(call LLVM_PATCH,llvm-4.0.0-D37576-NVPTX-sm_70)) # NVPTX, Remove for 6.0
$(eval $(call LLVM_PATCH,llvm-D38765-gvn_5.0)) # Remove for 6.0
endif # LLVM_VER
Expand Down
30 changes: 30 additions & 0 deletions deps/patches/llvm-5.0-NVPTX-addrspaces.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff -ru llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.cpp llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.cpp
--- llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.cpp 2017-07-12 22:49:21.000000000 +0200
+++ llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.cpp 2018-01-13 09:08:17.275987874 +0100
@@ -1235,6 +1235,14 @@
}
}

+bool NVPTXTargetLowering::isNoopAddrSpaceCast(unsigned SrcAS,
+ unsigned DestAS) const {
+ assert(SrcAS != DestAS && "Expected different address spaces!");
+
+ return (SrcAS == ADDRESS_SPACE_GENERIC || SrcAS > ADDRESS_SPACE_LOCAL) &&
+ (DestAS == ADDRESS_SPACE_GENERIC || DestAS > ADDRESS_SPACE_LOCAL);
+}
+
SDValue
NVPTXTargetLowering::LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const {
SDLoc dl(Op);
diff -ru llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.h llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.h
--- llvm-5.0.0.orig/lib/Target/NVPTX/NVPTXISelLowering.h 2018-01-13 09:07:48.839643576 +0100
+++ llvm-5.0.0/lib/Target/NVPTX/NVPTXISelLowering.h 2018-01-13 09:06:18.658551692 +0100
@@ -443,6 +443,8 @@
const NVPTXSubtarget &STI);
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;

+ bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override;
+
SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;

const char *getTargetNodeName(unsigned Opcode) const override;