
String pool merging currently, for a reason that's not entirely clear to me, tries to create GEP instructions instead of GEP constant expressions when replacing constant references. It only uses constant expressions in cases where this is required. However, it does not catch all cases where such a requirement exists. For example, the landingpad catch clause has to be a constant. Fix this by always using the constant expression variant, which also makes the implementation simpler. Additionally, there are some edge cases where even replacement with a constant GEP is not legal. The one I am aware of is the llvm.eh.typeid.for intrinsic, so add a special case to forbid replacements for it. Fixes https://github.com/llvm/llvm-project/issues/88844.
48 lines
1.3 KiB
LLVM
48 lines
1.3 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
|
|
; RUN: llc -mtriple=ppc64le-unknown-linux-gnu < %s | FileCheck %s
|
|
|
|
@id = private unnamed_addr constant [4 x i8] c"@id\00", align 1
|
|
@id2 = private unnamed_addr constant [5 x i8] c"@id2\00", align 1
|
|
|
|
; Higher-aligned dummy to make sure it is first in the string pool.
|
|
@dummy = private unnamed_addr constant [1 x i32] [i32 42], align 4
|
|
|
|
define ptr @test1() personality ptr @__gnu_objc_personality_v0 {
|
|
; CHECK-LABEL: test1:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: mflr 0
|
|
; CHECK-NEXT: stdu 1, -32(1)
|
|
; CHECK-NEXT: std 0, 48(1)
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 32
|
|
; CHECK-NEXT: .cfi_offset lr, 16
|
|
; CHECK-NEXT: addis 3, 2, .Ldummy@toc@ha
|
|
; CHECK-NEXT: addi 3, 3, .Ldummy@toc@l
|
|
; CHECK-NEXT: bl foo
|
|
; CHECK-NEXT: nop
|
|
invoke void @foo(ptr @dummy)
|
|
to label %cont unwind label %unwind
|
|
|
|
cont:
|
|
unreachable
|
|
|
|
unwind:
|
|
%lp = landingpad { ptr, i32 }
|
|
catch ptr @id
|
|
resume { ptr, i32 } %lp
|
|
}
|
|
|
|
define i32 @test2() personality ptr @__gnu_objc_personality_v0 {
|
|
; CHECK-LABEL: test2:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: li 3, 1
|
|
; CHECK-NEXT: blr
|
|
%id = tail call i32 @llvm.eh.typeid.for(ptr @id2)
|
|
ret i32 %id
|
|
}
|
|
|
|
declare i32 @__gnu_objc_personality_v0(...)
|
|
|
|
declare i32 @llvm.eh.typeid.for(ptr)
|
|
|
|
declare void @foo()
|