-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading CombinedParsers assert on 1.8 with "Illegal inttoptr" #45702
Comments
Looks like a magicptr is at fault here. Very simple to fix, assuming this won't cause regressions for anyone (which should be very unlikely since it is a very rare case, and early-cse, gvn, or newgvn will usually handle this better anyways): diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 399fc3baf7aa..53fa6f70a0a0 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -478,7 +478,7 @@ 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
diff --git a/llvm/test/Transforms/SimplifyCFG/unprofit2.ll b/llvm/test/Transforms/SimplifyCFG/unprofit2.ll
new file mode 100644
index 000000000000..00c295ddc5c6
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/unprofit2.ll
@@ -0,0 +1,29 @@
+; RUN: opt -simplifycfg -verify -S < %s | FileCheck %s
+; RUN: opt -passes=simplifycfg,verify -S < %s | FileCheck %s
+
+target datalayout = "ni:1"
+
+define void @test_01(i64 addrspace(1)* align 8 %ptr) local_unnamed_addr #0 {
+; CHECK-LABEL: @test_01(
+; CHECK-NOT: ptrtoint
+; CHECK-NEXT: icmp eq i64 addrspace(1)* %ptr, null
+; CHECK-NOT: ptrtoint
+ %cond1 = icmp eq i64 addrspace(1)* %ptr, null
+ %cond2 = icmp eq i64 addrspace(1)* %ptr, null
+ br i1 %cond1, label %true1, label %false1
+
+true1:
+ br i1 %cond2, label %true2, label %false2
+
+false1:
+ store i64 1, i64 addrspace(1)* %ptr, align 8
+ br label %true1
+
+true2:
+ store i64 2, i64 addrspace(1)* %ptr, align 8
+ ret void
+
+false2:
+ store i64 3, i64 addrspace(1)* %ptr, align 8
+ ret void
+} |
@vtjnash can you post this patch to upstream? |
Upstream: https://reviews.llvm.org/D128670 |
…ters 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 JuliaLang/julia#45702 Differential Revision: https://reviews.llvm.org/D128670 (cherry picked from commit b904e7e94c5cc9d86762b32211cd0e35670534cb)
…ters 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 JuliaLang/julia#45702 Differential Revision: https://reviews.llvm.org/D128670 (cherry picked from commit b904e7e94c5cc9d86762b32211cd0e35670534cb)
Picked up the fix and I am releasing a new binary for LLVM 13 JuliaPackaging/Yggdrasil#5092 |
…ters 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 JuliaLang/julia#45702 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D128670
…ters 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 JuliaLang/julia#45702 Differential Revision: https://reviews.llvm.org/D128670 (cherry picked from commit b904e7e94c5cc9d86762b32211cd0e35670534cb)
…ters 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 JuliaLang/julia#45702 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D128670
…ters 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 JuliaLang/julia#45702 Differential Revision: https://reviews.llvm.org/D128670 (cherry picked from commit b904e7e94c5cc9d86762b32211cd0e35670534cb)
…ters 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 JuliaLang/julia#45702 Differential Revision: https://reviews.llvm.org/D128670 (cherry picked from commit b904e7e94c5cc9d86762b32211cd0e35670534cb)
(Running with assertions on)
https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_hash/8b2e406_vs_742b9ab/CombinedParsers.primary.log
The text was updated successfully, but these errors were encountered: