[llvm] r289826 - Fix ubsan failures in lane mask shifts
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 15 08:08:49 PST 2016
Author: kparzysz
Date: Thu Dec 15 10:08:49 2016
New Revision: 289826
URL: http://llvm.org/viewvc/llvm-project?rev=289826&view=rev
Log:
Fix ubsan failures in lane mask shifts
Modified:
llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=289826&r1=289825&r2=289826&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Thu Dec 15 10:08:49 2016
@@ -778,8 +778,10 @@ RegisterInfoEmitter::emitComposeSubRegIn
" LaneBitmask Result;\n"
" for (const MaskRolOp *Ops = CompositeSequences[IdxA]; !Ops->Mask.none(); ++Ops) {\n"
" LaneBitmask::Type M = LaneMask.getAsInteger() & Ops->Mask.getAsInteger();\n"
- " unsigned S = Ops->RotateLeft;\n"
- " Result |= LaneBitmask((M << S) | (M >> (LaneBitmask::BitWidth - S)));\n"
+ " if (unsigned S = Ops->RotateLeft)\n"
+ " Result |= LaneBitmask((M << S) | (M >> (LaneBitmask::BitWidth - S)));\n"
+ " else\n"
+ " Result |= LaneBitmask(M);\n"
" }\n"
" return Result;\n"
"}\n\n";
@@ -793,8 +795,10 @@ RegisterInfoEmitter::emitComposeSubRegIn
" LaneBitmask Result;\n"
" for (const MaskRolOp *Ops = CompositeSequences[IdxA]; !Ops->Mask.none(); ++Ops) {\n"
" LaneBitmask::Type M = LaneMask.getAsInteger();\n"
- " unsigned S = Ops->RotateLeft;\n"
- " Result |= LaneBitmask((M >> S) | (M << (LaneBitmask::BitWidth - S)));\n"
+ " if (unsigned S = Ops->RotateLeft)\n"
+ " Result |= LaneBitmask((M >> S) | (M << (LaneBitmask::BitWidth - S)));\n"
+ " else\n"
+ " Result |= LaneBitmask(M);\n"
" }\n"
" return Result;\n"
"}\n\n";
More information about the llvm-commits
mailing list