Revert "Mark DIV/IDIV instructions hasSideEffects=1 because they can trap when dividi...
authorMichael Gottesman <mgottesman@apple.com>
Thu, 3 Jan 2013 08:18:30 +0000 (08:18 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Thu, 3 Jan 2013 08:18:30 +0000 (08:18 +0000)
This reverts commit r171461 since it breaks the following tests:

Clang :: Analysis/outofbound-notwork.c
Clang :: Analysis/string-fail.c
Clang :: CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp
Clang :: CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp
Clang :: CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
Clang :: CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp
Clang :: CXX/temp/temp.param/p14.cpp
Clang :: CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp
Clang :: CodeGen/2009-02-13-zerosize-union-field-ppc.c
Clang :: CodeGen/blocks-2.c
Clang :: CodeGen/libcalls-d.c
Clang :: CodeGen/libcalls-ld.c
Clang :: CodeGenCXX/conversion-function.cpp
Clang :: CodeGenCXX/debug-info-limit-type.cpp
Clang :: CodeGenCXX/inheriting-constructor.cpp
Clang :: FixIt/fixit-errors.c
Clang :: FixIt/fixit-pmem.cpp
Clang :: Modules/namespaces.cpp
Clang :: PCH/changed-files.c
Clang :: PCH/pr4489.c
Clang :: PCH/source-manager-stack.c
Clang :: Parser/cxx-ambig-decl-expr-xfail.cpp
Clang :: SemaCXX/switch-implicit-fallthrough-cxx98.cpp
Clang :: SemaTemplate/instantiate-function-1.mm

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171466 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrArithmetic.td
test/CodeGen/X86/early-ifcvt.ll

index 3540fc3125785b830a3197e708edc2161ced8cd0..d56763ea9d266b675beceb43dc872da8e357e226 100644 (file)
@@ -266,7 +266,7 @@ def IMUL64rmi8 : RIi8<0x6B, MRMSrcMem,                      // GR64 = [mem64]*I8
 
 
 // unsigned division/remainder
-let hasSideEffects = 1 in { // so that we don't speculatively execute
+let hasSideEffects = 0 in {
 let Defs = [AL,EFLAGS,AX], Uses = [AX] in
 def DIV8r  : I<0xF6, MRM6r, (outs),  (ins GR8:$src),    // AX/r8 = AL,AH
                "div{b}\t$src", [], IIC_DIV8_REG>;
index b3a20c3ee0b46bd6d1e6ddc46b3e479079fb2dbf..2e1852d3e3aefacd6713796383bd1f1db32ff77d 100644 (file)
@@ -142,35 +142,3 @@ save_state_and_return:
 }
 
 declare void @BZ2_bz__AssertH__fail()
-
-
-; Make sure we don't speculate on div/idiv instructions
-; CHECK: test_idiv
-; CHECK-NOT: cmov
-define i32 @test_idiv(i32 %a, i32 %b) nounwind uwtable readnone ssp {
-  %1 = icmp eq i32 %b, 0
-  br i1 %1, label %4, label %2
-
-; <label>:2                                       ; preds = %0
-  %3 = sdiv i32 %a, %b
-  br label %4
-
-; <label>:4                                       ; preds = %0, %2
-  %5 = phi i32 [ %3, %2 ], [ %a, %0 ]
-  ret i32 %5
-}
-
-; CHECK: test_div
-; CHECK-NOT: cmov
-define i32 @test_div(i32 %a, i32 %b) nounwind uwtable readnone ssp {
-  %1 = icmp eq i32 %b, 0
-  br i1 %1, label %4, label %2
-
-; <label>:2                                       ; preds = %0
-  %3 = udiv i32 %a, %b
-  br label %4
-
-; <label>:4                                       ; preds = %0, %2
-  %5 = phi i32 [ %3, %2 ], [ %a, %0 ]
-  ret i32 %5
-}