[llvm] cdead4f - [PowerPC][NFC] Fix an assert that cannot trip from 7d076e19e31a

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 25 17:32:54 PDT 2020


Author: Nemanja Ivanovic
Date: 2020-07-25T20:28:52-04:00
New Revision: cdead4f89c0eecf11f50092bc088e3a9c6511825

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

LOG: [PowerPC][NFC] Fix an assert that cannot trip from 7d076e19e31a

I mixed up the precedence of operators in the assert and thought I
had it right since there was no compiler warning. This just
adds the parentheses in the expression as needed.

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 8c28ead9f604..ae840a9fa37d 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -9311,7 +9311,8 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op,
   if (!BVNIsConstantSplat || SplatBitSize > 32) {
 
     bool IsPermutedLoad = false;
-    const SDValue *InputLoad = getNormalLoadInput(Op.getOperand(0), IsPermutedLoad);
+    const SDValue *InputLoad =
+        getNormalLoadInput(Op.getOperand(0), IsPermutedLoad);
     // Handle load-and-splat patterns as we have instructions that will do this
     // in one go.
     if (InputLoad && DAG.isSplatValue(Op, true)) {
@@ -9949,7 +9950,7 @@ SDValue PPCTargetLowering::LowerVECTOR_SHUFFLE(SDValue Op,
     if (IsPermutedLoad) {
       assert(isLittleEndian && "Unexpected permuted load on big endian target");
       SplatIdx += IsFourByte ? 2 : 1;
-      assert(SplatIdx < IsFourByte ? 4 : 2 &&
+      assert((SplatIdx < (IsFourByte ? 4 : 2)) &&
              "Splat of a value outside of the loaded memory");
     }
 


        


More information about the llvm-commits mailing list