Skip to content

Commit 6764869

Browse files
committed
[SystemZ] Add NoMerge MIFlag
Summary: This fixes ASan and MSan tests on SystemZ after commit 6a822e2 ("[ASan][MSan] Remove EmptyAsm and set the CallInst to nomerge to avoid from merging."). Based on commit 80e107c ("Add NoMerge MIFlag to avoid MIR branch folding"). Reviewers: uweigand, jonpa Reviewed By: uweigand Subscribers: hiraditya, llvm-commits, Andreas-Krebbel Tags: #llvm Differential Revision: https://reviews.llvm.org/D82794
1 parent 815a810 commit 6764869

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI,
16751675
if (IsTailCall)
16761676
return DAG.getNode(SystemZISD::SIBCALL, DL, NodeTys, Ops);
16771677
Chain = DAG.getNode(SystemZISD::CALL, DL, NodeTys, Ops);
1678+
DAG.addNoMergeSiteInfo(Chain.getNode(), CLI.NoMerge);
16781679
Glue = Chain.getValue(1);
16791680

16801681
// Mark the end of the call, which is glued to the call itself.

llvm/test/CodeGen/SystemZ/nomerge.ll

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; RUN: llc < %s -mtriple=s390x-linux-gnu -o - | FileCheck %s
2+
3+
define void @foo(i32 %i) {
4+
entry:
5+
switch i32 %i, label %if.end3 [
6+
i32 5, label %if.then
7+
i32 7, label %if.then2
8+
]
9+
10+
if.then:
11+
tail call void @bar() #0
12+
br label %if.end3
13+
14+
if.then2:
15+
tail call void @bar() #0
16+
br label %if.end3
17+
18+
if.end3:
19+
tail call void @bar() #0
20+
ret void
21+
}
22+
23+
declare void @bar()
24+
25+
attributes #0 = { nomerge }
26+
27+
; CHECK-LABEL: foo:
28+
; CHECK: # %bb.0: # %entry
29+
; CHECK: # %bb.1: # %entry
30+
; CHECK: # %bb.2: # %if.then
31+
; CHECK-NEXT: brasl %r14, bar@PLT
32+
; CHECK: jg bar@PLT
33+
; CHECK: .LBB0_3: # %if.then2
34+
; CHECK: brasl %r14, bar@PLT
35+
; CHECK: .LBB0_4: # %if.end3
36+
; CHECK: jg bar@PLT

0 commit comments

Comments
 (0)