Fix left shift overflow UB in PPC backend on LLP64 platforms
authorReid Kleckner <rnk@google.com>
Sun, 20 Dec 2020 01:45:49 +0000 (17:45 -0800)
committerReid Kleckner <rnk@google.com>
Sun, 20 Dec 2020 01:46:09 +0000 (17:46 -0800)
llvm/lib/Target/PowerPC/PPCISelLowering.cpp

index 3d9a543..18e35f5 100644 (file)
@@ -9189,7 +9189,7 @@ static SDValue getCanonicalConstSplat(uint64_t Val, unsigned SplatSize, EVT VT,
   EVT ReqVT = VT != MVT::Other ? VT : VTys[SplatSize-1];
 
   // For a splat with all ones, turn it to vspltisb 0xFF to canonicalize.
-  if (Val == ((1LU << (SplatSize * 8)) - 1)) {
+  if (Val == ((1LLU << (SplatSize * 8)) - 1)) {
     SplatSize = 1;
     Val = 0xFF;
   }