Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 2103613002: Subzero: Fix a potential null-pointer dereference. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringX86BaseImpl.h
diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h
index 1dcb9a3d865dc95f6c107be00c6894838ad0a7dd..0cd2789c3841d6823415b2f8c5c1798eee5148cb 100644
--- a/src/IceTargetLoweringX86BaseImpl.h
+++ b/src/IceTargetLoweringX86BaseImpl.h
@@ -5327,14 +5327,17 @@ const Inst *AddressOptimizer::matchOffsetIndexOrBase(
}
} else if (VarDef->getOp() == InstArithmetic::Mul) {
SizeT PowerOfTwo = 0;
- ConstantInteger32 *MultConst =
- llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(0));
- if (llvm::isPowerOf2_32(MultConst->getValue())) {
- PowerOfTwo += MultConst->getValue();
+ if (auto *MultConst =
+ llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(0))) {
+ if (llvm::isPowerOf2_32(MultConst->getValue())) {
+ PowerOfTwo += MultConst->getValue();
+ }
}
- MultConst = llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1));
- if (llvm::isPowerOf2_32(MultConst->getValue())) {
- PowerOfTwo += MultConst->getValue();
+ if (auto *MultConst =
+ llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1))) {
+ if (llvm::isPowerOf2_32(MultConst->getValue())) {
+ PowerOfTwo += MultConst->getValue();
+ }
}
ZeroesAvailable = llvm::Log2_32(PowerOfTwo) + 1;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698