[PATCH] D88082: [SystemZ] Make sure not to call getZExtValue on a >64 bit constant.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 07:48:52 PDT 2020


RKSimon added a reviewer: RKSimon.
RKSimon added a comment.

test case?



================
Comment at: llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp:863
           if (const ConstantInt *C = dyn_cast<ConstantInt>(I->getOperand(1)))
             if (!Ld->hasOneUse() && Ld->getParent() == I->getParent() &&
----------------
Bit tricky without context diff but I think you can just use C->isZero() and drop the ScalarBits limit


================
Comment at: llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp:1023
       if (ConstantInt *CI = dyn_cast<ConstantInt>(UserI->getOperand(1)))
-        if (isUInt<16>(CI->getZExtValue()))
+        if (CI->getBitWidth() <= 64 && isUInt<16>(CI->getZExtValue()))
           return true;
----------------
You should be able to do this with CI->getValue().isIntN(16) - no need for getBitWidth() checks


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88082/new/

https://reviews.llvm.org/D88082



More information about the llvm-commits mailing list