Skip to content

Commit 282e1e8

Browse files
committed
Support no-op pointer casts
`ICastOp`s that change the pointee type become no-ops by the time we get to LLVM with opaque pointer types, but we should still declare those as supported casts.
1 parent 76e766b commit 282e1e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib/JIT.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ compileInstr instr = case instr of
369369
(L.FloatingPointType _, L.IntegerType _) -> emitInstr dt $ L.FPToSI x dt []
370370
(L.IntegerType _, L.FloatingPointType _) -> emitInstr dt $ L.SIToFP x dt []
371371
#if MIN_VERSION_llvm_hs(15,0,0)
372+
-- Pointee casts become no-ops, because LLVM uses opaque pointers
373+
(L.PointerType a , L.PointerType a') | a == a' -> return x
372374
(L.IntegerType 64, ptrTy@(L.PointerType _)) -> emitInstr ptrTy $ L.IntToPtr x ptrTy []
373375
(L.PointerType _ , L.IntegerType 64) -> emitInstr i64 $ L.PtrToInt x i64 []
374376
#else

0 commit comments

Comments
 (0)