[llvm-commits] [PATCH] Fixing faulty memsets

Duncan Sands baldrick at free.fr
Sat Mar 10 20:16:01 PST 2012


Hi Aaron,

+      ConstantInt *Length = cast<ConstantInt>(MSI->getLength());
+      unsigned NumBytes = Length->getZExtValue();
+      if (NumBytes != 0 && !Length->isNegative()) {

instead you could do:

   int NumBytes = Length->getSExtValue();
   if (NumBytes > 0) {

Ciao, Duncan.



More information about the llvm-commits mailing list