summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2014-07-16 21:08:10 +0000
committerSanjay Patel <spatel@rotateright.com>2014-07-16 21:08:10 +0000
commitab60d04363bf9aac9f4754ab91d0ab520f30ae79 (patch)
treec57ee4229971575f49ce365d92d32d1dd43d7bfa /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent0fdd3ae54d07ec8a84efa9ff676d64d7693f88dc (diff)
downloadbcm5719-llvm-ab60d04363bf9aac9f4754ab91d0ab520f30ae79.tar.gz
bcm5719-llvm-ab60d04363bf9aac9f4754ab91d0ab520f30ae79.zip
trivial fix for PR20314
Make sure that the AddrInst is an Instruction. llvm-svn: 213197
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index ccac40c6696..f2c7e642710 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -2130,8 +2130,11 @@ bool AddressingModeMatcher::MatchOperationAddr(User *AddrInst, unsigned Opcode,
return true;
}
case Instruction::SExt: {
+ // Make sure this isn't a ConstantExpr (PR20314).
+ Instruction *SExt = dyn_cast<Instruction>(AddrInst);
+ if (!SExt) return false;
+
// Try to move this sext out of the way of the addressing mode.
- Instruction *SExt = cast<Instruction>(AddrInst);
// Ask for a method for doing so.
TypePromotionHelper::Action TPH = TypePromotionHelper::getAction(
SExt, InsertedTruncs, TLI, PromotedInsts);
OpenPOWER on IntegriCloud