aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2020-06-24 21:11:49 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2020-06-25 00:58:53 +0300
commit2b8d706b19c0e049da3eb62572b08af72ba2e5e6 (patch)
tree08a1564f29f9d84526d71a7a0beca6291cd4dd96 /llvm/lib/Analysis/ValueTracking.cpp
parent381054a989ebd0b585fee46f2a01a7c5de10acf7 (diff)
downloadllvm-2b8d706b19c0e049da3eb62572b08af72ba2e5e6.zip
llvm-2b8d706b19c0e049da3eb62572b08af72ba2e5e6.tar.gz
llvm-2b8d706b19c0e049da3eb62572b08af72ba2e5e6.tar.bz2
[IR] GetUnderlyingObject(), stripPointerCastsAndOffsets(): don't crash on `bitcast <1 x i8*> to i8*`
I'm not sure how to write standalone tests for each of two changes here. If either one of these two fixes is missing, the test fill crash.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 927add4..9db6aab 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4147,6 +4147,8 @@ Value *llvm::GetUnderlyingObject(Value *V, const DataLayout &DL,
} else if (Operator::getOpcode(V) == Instruction::BitCast ||
Operator::getOpcode(V) == Instruction::AddrSpaceCast) {
V = cast<Operator>(V)->getOperand(0);
+ if (!V->getType()->isPointerTy())
+ return V;
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
if (GA->isInterposable())
return V;