diff options
| author | Neil Henning <neil.henning@amd.com> | 2018-11-02 10:24:57 +0000 |
|---|---|---|
| committer | Neil Henning <neil.henning@amd.com> | 2018-11-02 10:24:57 +0000 |
| commit | 7d1b77df57fb6a14d2ef15f0e9123650ccee0cc4 (patch) | |
| tree | 4ab9a23280dd53270e03457dee19ae2bcde64e25 | |
| parent | cb50e23ba86ecfbb22f0eb1eec2fde9cc0c55569 (diff) | |
| download | bcm5719-llvm-7d1b77df57fb6a14d2ef15f0e9123650ccee0cc4.tar.gz bcm5719-llvm-7d1b77df57fb6a14d2ef15f0e9123650ccee0cc4.zip | |
[AMDGPU] UBSan bug fix for r345710
UBSan detected an error in our ISelLowering that is exposed only when
you have a dmask == 0x1. Fix this by adding in an explicit check to
ensure we don't do the UBSan detected shl << 32.
llvm-svn: 345962
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index 66eb9bbb84c..55b1a872484 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -8799,7 +8799,7 @@ SDNode *SITargetLowering::adjustWritemask(MachineSDNode *&Node, // Set which texture component corresponds to the lane. unsigned Comp; - for (unsigned i = 0, Dmask = OldDmask; i <= Lane; i++) { + for (unsigned i = 0, Dmask = OldDmask; (i <= Lane) && (Dmask != 0); i++) { Comp = countTrailingZeros(Dmask); Dmask &= ~(1 << Comp); } |

