-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[DirectX] Lower llvm.lifetime.*
intrinsics to stores when DXIL version is lower than 1.6
#147432
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
Conversation
You can test this locally with the following command:git diff -U0 --pickaxe-regex -S '([^a-zA-Z0-9#_-]undef[^a-zA-Z0-9_-]|UndefValue::get)' 'HEAD~1' HEAD llvm/test/CodeGen/DirectX/legalize-lifetimes-valver-1.6.ll llvm/lib/Target/DirectX/DXILOpLowering.cpp llvm/test/CodeGen/DirectX/legalize-lifetimes-valver-1.5.ll The following files introduce new uses of undef:
Undef is now deprecated and should only be used in the rare cases where no replacement is possible. For example, a load of uninitialized memory yields In tests, avoid using For example, this is considered a bad practice: define void @fn() {
...
br i1 undef, ...
} Please use the following instead: define void @fn(i1 %cond) {
...
br i1 %cond, ...
} Please refer to the Undefined Behavior Manual for more information. |
Since the undef is just for DXIL, it should be fine to ignore this? There are other uses of |
This should be fine DXC will always need undef since llvm 3.7 uses 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.
LGTM. Assuming farzons feedback is addressed.
PR #149310 has broken a test implemented by this PR ( I will revert this PR and rethink how to implement lifetime legalization for DXIL. |
…XIL version is lower than 1.6 (llvm#147432)" This reverts commit d47c126.
Fixes #147394
References DXC for the implementation logic:
https://github.com/microsoft/DirectXShaderCompiler/blob/d751c827ed3b61e87fdf57d0f424cb2d7af30cd0/lib/HLSL/DxilPreparePasses.cpp#L693-L699
If DXIL Version < 1.6 then replace lifetime intrinsics with stores
else keep the lifetime intrinsics in the DXIL.
After this PR, the number of DML shaders failing validation due to #146974 is reduced from 157 to 50.