[llvm] r210909 - SCCP: update for cmpxchg returning { iN, i1 } now.

Tim Northover tnorthover at apple.com
Fri Jun 13 07:54:09 PDT 2014


Author: tnorthover
Date: Fri Jun 13 09:54:09 2014
New Revision: 210909

URL: http://llvm.org/viewvc/llvm-project?rev=210909&view=rev
Log:
SCCP: update for cmpxchg returning { iN, i1 } now.

I accidentally missed this one since its use looked OK locally.

Added:
    llvm/trunk/test/Transforms/SCCP/atomic.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/SCCP.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=210909&r1=210908&r2=210909&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Fri Jun 13 09:54:09 2014
@@ -494,7 +494,9 @@ private:
   void visitResumeInst    (TerminatorInst &I) { /*returns void*/ }
   void visitUnreachableInst(TerminatorInst &I) { /*returns void*/ }
   void visitFenceInst     (FenceInst &I) { /*returns void*/ }
-  void visitAtomicCmpXchgInst (AtomicCmpXchgInst &I) { markOverdefined(&I); }
+  void visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) {
+    markAnythingOverdefined(&I);
+  }
   void visitAtomicRMWInst (AtomicRMWInst &I) { markOverdefined(&I); }
   void visitAllocaInst    (Instruction &I) { markOverdefined(&I); }
   void visitVAArgInst     (Instruction &I) { markAnythingOverdefined(&I); }

Added: llvm/trunk/test/Transforms/SCCP/atomic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/atomic.ll?rev=210909&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SCCP/atomic.ll (added)
+++ llvm/trunk/test/Transforms/SCCP/atomic.ll Fri Jun 13 09:54:09 2014
@@ -0,0 +1,9 @@
+; RUN: opt < %s -sccp -S | FileCheck %s
+
+define i1 @test_cmpxchg(i32* %addr, i32 %desired, i32 %new) {
+; CHECK-LABEL: @test_cmpxchg
+; CHECK: cmpxchg i32* %addr, i32 %desired, i32 %new seq_cst seq_cst
+  %val = cmpxchg i32* %addr, i32 %desired, i32 %new seq_cst seq_cst
+  %res = extractvalue { i32, i1 } %val, 1
+  ret i1 %res
+}





More information about the llvm-commits mailing list