diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2016-09-20 15:49:58 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2016-09-20 15:49:58 +0000 |
| commit | d9bce5062ef3c4df89319c17e4fc2cf46a46501b (patch) | |
| tree | 9c1ec400eb77f6e0735e691f55fff812d3b4ac5d | |
| parent | b45fd70ef1f95bcfd4da7457a1a309257d31dafe (diff) | |
| download | bcm5719-llvm-d9bce5062ef3c4df89319c17e4fc2cf46a46501b.tar.gz bcm5719-llvm-d9bce5062ef3c4df89319c17e4fc2cf46a46501b.zip | |
Replace 'isProvablyNonNull' with existing utility llvm::IsKnownNonNull which handles more cases. Noticed by inspection.
Because of how the IR generation works, this isn't expected to cause an observable difference.
llvm-svn: 281979
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 454cc5e3e77..4a24e42512a 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -29,6 +29,7 @@ #include "clang/CodeGen/SwiftCallingConv.h" #include "clang/Frontend/CodeGenOptions.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/CallingConv.h" #include "llvm/IR/CallSite.h" @@ -2905,10 +2906,6 @@ static bool isProvablyNull(llvm::Value *addr) { return isa<llvm::ConstantPointerNull>(addr); } -static bool isProvablyNonNull(llvm::Value *addr) { - return isa<llvm::AllocaInst>(addr); -} - /// Emit the actual writing-back of a writeback. static void emitWriteback(CodeGenFunction &CGF, const CallArgList::Writeback &writeback) { @@ -2921,7 +2918,7 @@ static void emitWriteback(CodeGenFunction &CGF, // If the argument wasn't provably non-null, we need to null check // before doing the store. - bool provablyNonNull = isProvablyNonNull(srcAddr.getPointer()); + bool provablyNonNull = llvm::isKnownNonNull(srcAddr.getPointer()); if (!provablyNonNull) { llvm::BasicBlock *writebackBB = CGF.createBasicBlock("icr.writeback"); contBB = CGF.createBasicBlock("icr.done"); @@ -3061,7 +3058,7 @@ static void emitWritebackArg(CodeGenFunction &CGF, CallArgList &args, // If the address is *not* known to be non-null, we need to switch. llvm::Value *finalArgument; - bool provablyNonNull = isProvablyNonNull(srcAddr.getPointer()); + bool provablyNonNull = llvm::isKnownNonNull(srcAddr.getPointer()); if (provablyNonNull) { finalArgument = temp.getPointer(); } else { |

