[llvm] 576fa5a - [AMDGPU] make ubsan happy with unsigned left shift

Mekhanoshin, Stanislav via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 17:34:34 PDT 2020


[AMD Official Use Only - Internal Distribution Only]

I need to figure it out. It is tablegen produced some C++ code, which in turn resulted in UB. At the moment I have just put the constant there to clear the testing, the actual expected behavior is still questionable. It was !shl($var, 11) and the $var was negative. So it is a shift of a negative value. I do not see any issue with the shl of a negative value in 2-complement off hand given the size is the same size.

Stas

From: Arsenault, Matthew <Matthew.Arsenault at amd.com>
Sent: Monday, June 15, 2020 17:28
To: llvm-commits at lists.llvm.org; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin at amd.com>; Stanislav Mekhanoshin <llvmlistbot at llvm.org>
Subject: Re: [llvm] 576fa5a - [AMDGPU] make ubsan happy with unsigned left shift


[AMD Official Use Only - Internal Distribution Only]

This was in the tabelgen shift? Tablegen should be fixed instead?

________________________________
From: llvm-commits <llvm-commits-bounces at lists.llvm.org<mailto:llvm-commits-bounces at lists.llvm.org>> on behalf of Stanislav Mekhanoshin via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>>
Sent: Monday, June 15, 2020 5:21 PM
To: llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org> <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>>
Subject: [llvm] 576fa5a - [AMDGPU] make ubsan happy with unsigned left shift


Author: Stanislav Mekhanoshin
Date: 2020-06-15T17:21:10-07:00
New Revision: 576fa5a50c8509977835031d190f8906e1dbb075

URL: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project%2Fcommit%2F576fa5a50c8509977835031d190f8906e1dbb075&data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636882998969&sdata=03WSLSu42FOTqFmGc%2FedlUjWr5X0QmQdPOb%2FDkmrULk%3D&reserved=0
DIFF: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project%2Fcommit%2F576fa5a50c8509977835031d190f8906e1dbb075.diff&data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636883008962&sdata=Y4UJC7EUNn1yiWrwNcXJ5idm1%2Bi%2B3BZRlzUULZ1wguE%3D&reserved=0

LOG: [AMDGPU] make ubsan happy with unsigned left shift

Fixes UBSAN error after rG9ee272f13d88f090817235ef4f91e56bb2a153d6
A trivial signed/unsigned shift.

Added:


Modified:
    llvm/lib/Target/AMDGPU/SMInstructions.td

Removed:



################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SMInstructions.td b/llvm/lib/Target/AMDGPU/SMInstructions.td
index 252f191a2f66..df21c864ccad 100644
--- a/llvm/lib/Target/AMDGPU/SMInstructions.td
+++ b/llvm/lib/Target/AMDGPU/SMInstructions.td
@@ -860,7 +860,7 @@ let OtherPredicates = [HasNoSMemTimeInst] in {
 def : GCNPat <
   (i64 (readcyclecounter)),
   (REG_SEQUENCE SReg_64,
-    (S_GETREG_B32 getHwRegImm<HWREG.SHADER_CYCLES, 0, -12>.ret), sub0,
+    (S_GETREG_B32 -26595), sub0,
     (S_MOV_B32 (i32 0)), sub1)
 >;
 } // let OtherPredicates = [HasNoSMemTimeInst]



_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits&data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636883008962&sdata=K4JiBEwIXLcAuBoYnoMN%2BiJ3t29BioFc5%2BC%2FUeW%2BYjg%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200616/34b1eb65/attachment.html>


More information about the llvm-commits mailing list