summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-07-08 08:43:31 +0000
committerFangrui Song <maskray@google.com>2019-07-08 08:43:31 +0000
commit7d63be09b6a6ee8b940a15bf823bf2f90d34c18e (patch)
tree38c0bca05df763b010ae647229c9208b9ed0e76c
parent0464e07c8f6e3310c28eb210a4513bc2243c2a7e (diff)
downloadbcm5719-llvm-7d63be09b6a6ee8b940a15bf823bf2f90d34c18e.tar.gz
bcm5719-llvm-7d63be09b6a6ee8b940a15bf823bf2f90d34c18e.zip
[ARM] Fix null pointer dereference in CodeGen/ARM/Windows/stack-protector-msvc.ll.test after D64292/r365283
CLI.CS may not be set. llvm-svn: 365299
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 2505cf71688..36b669b8526 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -1981,12 +1981,14 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
// more times in this block, we can improve codesize by calling indirectly
// as BLXr has a 16-bit encoding.
auto *GV = cast<GlobalAddressSDNode>(Callee)->getGlobal();
- auto *BB = CLI.CS.getParent();
- PreferIndirect =
- Subtarget->isThumb() && Subtarget->hasMinSize() &&
- count_if(GV->users(), [&BB](const User *U) {
- return isa<Instruction>(U) && cast<Instruction>(U)->getParent() == BB;
- }) > 2;
+ if (CLI.CS) {
+ auto *BB = CLI.CS.getParent();
+ PreferIndirect = Subtarget->isThumb() && Subtarget->hasMinSize() &&
+ count_if(GV->users(), [&BB](const User *U) {
+ return isa<Instruction>(U) &&
+ cast<Instruction>(U)->getParent() == BB;
+ }) > 2;
+ }
}
if (isTailCall) {
// Check if it's really possible to do a tail call.
OpenPOWER on IntegriCloud