[PATCH] D45343: Always remove null check before free
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 5 17:31:50 PDT 2018
xbolva00 created this revision.
Herald added a subscriber: llvm-commits.
Null check before free is currently removed only when we are optimizing for size. This patch removes that limitation.
Repository:
rL LLVM
https://reviews.llvm.org/D45343
Files:
InstructionCombining.cpp
Index: InstructionCombining.cpp
===================================================================
--- InstructionCombining.cpp
+++ InstructionCombining.cpp
@@ -2327,15 +2327,14 @@
if (isa<ConstantPointerNull>(Op))
return eraseInstFromFunction(FI);
- // If we optimize for code size, try to move the call to free before the null
- // test so that simplify cfg can remove the empty block and dead code
- // elimination the branch. I.e., helps to turn something like:
+ // Try to move the call to free before the null test so that simplify
+ // cfg can remove the empty block and dead code elimination the branch.
+ // helps to turn something like:
// if (foo) free(foo);
// into
// free(foo);
- if (MinimizeSize)
- if (Instruction *I = tryToMoveFreeBeforeNullTest(FI))
- return I;
+ if (Instruction *I = tryToMoveFreeBeforeNullTest(FI))
+ return I;
return nullptr;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45343.141246.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180406/c8fd5d3a/attachment.bin>
More information about the llvm-commits
mailing list