aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorJameson Nash <vtjnash@gmail.com>2022-08-15 15:09:46 -0400
committerValentin Churavy <v.churavy@gmail.com>2022-08-15 15:11:48 -0400
commit3a8d7fe20199aa73590d7a240ac9376624203b7f (patch)
treee9558787b3ba638c5b6d99ccf6861f778720b395 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent31fbdab376a4f90d793d16d4a4523be7d30d2604 (diff)
downloadllvm-3a8d7fe20199aa73590d7a240ac9376624203b7f.zip
llvm-3a8d7fe20199aa73590d7a240ac9376624203b7f.tar.gz
llvm-3a8d7fe20199aa73590d7a240ac9376624203b7f.tar.bz2
[SimplifyCFG] teach simplifycfg not to introduce ptrtoint for NI pointers
SimplifyCFG expects to be able to cast both sides to an int, if either side can be case to an int, but this is not desirable or legal, in general, per D104547. Spotted in https://github.com/JuliaLang/julia/issues/45702 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D128670
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 197b0d7..76f09c0 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -473,7 +473,8 @@ static bool dominatesMergePoint(Value *V, BasicBlock *BB,
static ConstantInt *GetConstantInt(Value *V, const DataLayout &DL) {
// Normal constant int.
ConstantInt *CI = dyn_cast<ConstantInt>(V);
- if (CI || !isa<Constant>(V) || !V->getType()->isPointerTy())
+ if (CI || !isa<Constant>(V) || !V->getType()->isPointerTy() ||
+ DL.isNonIntegralPointerType(V->getType()))
return CI;
// This is some kind of pointer constant. Turn it into a pointer-sized