[llvm] fc6af7e - [AMDGPU] Fix error handling in asm constraint syntax

Stanislav Mekhanoshin via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 09:33:58 PST 2022


Author: Stanislav Mekhanoshin
Date: 2022-01-13T09:33:50-08:00
New Revision: fc6af7e188cc426b13d175266620e831c986798a

URL: https://github.com/llvm/llvm-project/commit/fc6af7e188cc426b13d175266620e831c986798a
DIFF: https://github.com/llvm/llvm-project/commit/fc6af7e188cc426b13d175266620e831c986798a.diff

LOG: [AMDGPU] Fix error handling in asm constraint syntax

I believe this is unexploitable because in either case the result
will be 'couldn't allocate register for constraint' error message,
but error code checking is clearly wrong.

Differential Revision: https://reviews.llvm.org/D117189

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index af96b289c4d1..a891b62cb24e 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -11760,9 +11760,9 @@ SITargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI_,
       if (RegName.consume_front("[")) {
         uint32_t End;
         bool Failed = RegName.consumeInteger(10, Idx);
-        Failed &= !RegName.consume_front(":");
-        Failed &= RegName.consumeInteger(10, End);
-        Failed &= !RegName.consume_back("]");
+        Failed |= !RegName.consume_front(":");
+        Failed |= RegName.consumeInteger(10, End);
+        Failed |= !RegName.consume_back("]");
         if (!Failed) {
           uint32_t Width = (End - Idx + 1) * 32;
           MCRegister Reg = RC->getRegister(Idx);


        


More information about the llvm-commits mailing list