[llvm] 6764869 - [SystemZ] Add NoMerge MIFlag

Ilya Leoshkevich via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 03:45:04 PDT 2020


Author: Ilya Leoshkevich
Date: 2020-06-30T12:44:45+02:00
New Revision: 6764869548a23d03b10b0a9af7aeac534959af29

URL: https://github.com/llvm/llvm-project/commit/6764869548a23d03b10b0a9af7aeac534959af29
DIFF: https://github.com/llvm/llvm-project/commit/6764869548a23d03b10b0a9af7aeac534959af29.diff

LOG: [SystemZ] Add NoMerge MIFlag

Summary:
This fixes ASan and MSan tests on SystemZ after
commit 6a822e20ce70 ("[ASan][MSan] Remove EmptyAsm and set the CallInst
to nomerge to avoid from merging.").

Based on commit 80e107ccd088 ("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

Added: 
    llvm/test/CodeGen/SystemZ/nomerge.ll

Modified: 
    llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 0d71c7fed5d4..eb1e51341ec4 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -1675,6 +1675,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI,
   if (IsTailCall)
     return DAG.getNode(SystemZISD::SIBCALL, DL, NodeTys, Ops);
   Chain = DAG.getNode(SystemZISD::CALL, DL, NodeTys, Ops);
+  DAG.addNoMergeSiteInfo(Chain.getNode(), CLI.NoMerge);
   Glue = Chain.getValue(1);
 
   // Mark the end of the call, which is glued to the call itself.

diff  --git a/llvm/test/CodeGen/SystemZ/nomerge.ll b/llvm/test/CodeGen/SystemZ/nomerge.ll
new file mode 100644
index 000000000000..6ccbf9a1bfc1
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/nomerge.ll
@@ -0,0 +1,36 @@
+; RUN: llc < %s -mtriple=s390x-linux-gnu -o - | FileCheck %s
+
+define void @foo(i32 %i) {
+entry:
+  switch i32 %i, label %if.end3 [
+    i32 5, label %if.then
+    i32 7, label %if.then2
+  ]
+
+if.then:
+  tail call void @bar() #0
+  br label %if.end3
+
+if.then2:
+  tail call void @bar() #0
+  br label %if.end3
+
+if.end3:
+  tail call void @bar() #0
+  ret void
+}
+
+declare void @bar()
+
+attributes #0 = { nomerge }
+
+; CHECK-LABEL: foo:
+; CHECK: # %bb.0: # %entry
+; CHECK: # %bb.1: # %entry
+; CHECK: # %bb.2: # %if.then
+; CHECK-NEXT: brasl %r14, bar at PLT
+; CHECK: jg bar at PLT
+; CHECK: .LBB0_3: # %if.then2
+; CHECK: brasl %r14, bar at PLT
+; CHECK: .LBB0_4: # %if.end3
+; CHECK: jg bar at PLT


        


More information about the llvm-commits mailing list