-
Notifications
You must be signed in to change notification settings - Fork 88
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
Lower llvm intrinsics early #1363
base: main
Are you sure you want to change the base?
Conversation
8e3a917
to
3e2bbd6
Compare
lib/Compiler.cpp
Outdated
|
||
pm.addPass(clspv::ReplaceLLVMIntrinsicsPass()); | ||
|
||
if (clspv::Option::LanguageUsesGenericAddressSpace()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you put this addPass outside of the if statement?
If we really want it outside, maybe put it before the comment, and add comment before it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it outside because it helps in general, and I thought it's somewhat a big change for it to just change due to generic address space.
I moved it more to the top of the pipeline with a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide a test showing how it helps in general, it's not clear to me looking at the modified tests. test/LLVMIntrinsics/memcpy_from_constant.cl
even tends to say that it is not helping.
3e2bbd6
to
918bbe6
Compare
The LowerAddrSpaceCast pass obfuscates all intrinsics calls, so the rest of the llvm pipeline doesn't recognize them.
Additionally, lowering early might mean that the subsituted code has a chance of getting optimized more aggressively.
The tests fallout is:
test/CPlusPlus/issue-357.cl
The old testCopyInstance2 is now optimized out (it was copying uninitialized memory). The test now initializes the data before the copy.
test/LLVMIntrinsics/descend_into_array.cl
The PR results in some instructions being re-ordered.
test/LLVMIntrinsics/memcpy_from_constant.cl
This seems to be a minor regression.
Instead of:
the llvm ir before the producer is:
This seems to be due to the
HideConstantLoadsPass
/UnhideConstantLoadsPass
. Maybe it's too disruptive for the issue it was trying to fix? (#71)I will open an issue for this regression.
This closes #1350 and #1355