Revert "[Attributor] Move pass after InstCombine to futher eliminate null pointer...
authorDávid Bolvanský <david.bolvansky@gmail.com>
Wed, 27 Nov 2019 21:44:43 +0000 (22:44 +0100)
committerDávid Bolvanský <david.bolvansky@gmail.com>
Wed, 27 Nov 2019 21:45:47 +0000 (22:45 +0100)
This reverts commit 7ca7d62c6ea1680ec0a1861083669596547fdd6f. Commited accidentally.

llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
llvm/test/Transforms/PhaseOrdering/null-check-elim.ll [deleted file]

index db25e61..8142422 100644 (file)
@@ -530,6 +530,9 @@ void PassManagerBuilder::populateModulePassManager(
   MPM.add(createIPSCCPPass());          // IP SCCP
   MPM.add(createCalledValuePropagationPass());
 
+  // Infer attributes on declarations, call sites, arguments, etc.
+  MPM.add(createAttributorLegacyPass());
+
   MPM.add(createGlobalOptimizerPass()); // Optimize out global vars
   // Promote any localized global vars.
   MPM.add(createPromoteMemoryToRegisterPass());
@@ -537,8 +540,6 @@ void PassManagerBuilder::populateModulePassManager(
   MPM.add(createDeadArgEliminationPass()); // Dead argument elimination
 
   addInstructionCombiningPass(MPM); // Clean up after IPCP & DAE
-  // Infer attributes on declarations, call sites, arguments, etc.
-  MPM.add(createAttributorLegacyPass());
   addExtensionsToPM(EP_Peephole, MPM);
   MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE
 
diff --git a/llvm/test/Transforms/PhaseOrdering/null-check-elim.ll b/llvm/test/Transforms/PhaseOrdering/null-check-elim.ll
deleted file mode 100644 (file)
index 4c06045..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -O3 -attributor-disable=false -S < %s                    | FileCheck %s --check-prefixes=ANY,OLDPM
-; RUN: opt -passes='default<O3>' -attributor-disable=false -S < %s  | FileCheck %s --check-prefixes=ANY,NEWPM
-
-@p = external global [2 x i8*], align 16
-
-define void @test(i8* %arg, i32 %arg1) {
-; OLDPM-LABEL: @test(
-; OLDPM-NEXT:  bb5:
-; OLDPM-NEXT:    [[TMP:%.*]] = tail call i8* @strchr(i8* nofree nonnull dereferenceable(1) [[ARG:%.*]], i32 [[ARG1:%.*]]) #1
-; OLDPM-NEXT:    store i8* [[TMP]], i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @p, i64 0, i64 0), align 16
-; OLDPM-NEXT:    [[TMP4:%.*]] = tail call i8* @foo(i8* nonnull [[ARG]])
-; OLDPM-NEXT:    store i8* [[TMP4]], i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @p, i64 0, i64 1), align 8
-; OLDPM-NEXT:    ret void
-;
-; NEWPM-LABEL: @test(
-; NEWPM-NEXT:  bb:
-; NEWPM-NEXT:    [[TMP:%.*]] = tail call i8* @strchr(i8* nonnull dereferenceable(1) [[ARG:%.*]], i32 [[ARG1:%.*]])
-; NEWPM-NEXT:    store i8* [[TMP]], i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @p, i64 0, i64 0), align 16
-; NEWPM-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[ARG]], null
-; NEWPM-NEXT:    br i1 [[TMP2]], label [[BB5:%.*]], label [[BB3:%.*]]
-; NEWPM:       bb3:
-; NEWPM-NEXT:    [[TMP4:%.*]] = tail call i8* @foo(i8* nonnull [[ARG]])
-; NEWPM-NEXT:    br label [[BB5]]
-; NEWPM:       bb5:
-; NEWPM-NEXT:    [[TMP6:%.*]] = phi i8* [ [[TMP4]], [[BB3]] ], [ null, [[BB:%.*]] ]
-; NEWPM-NEXT:    store i8* [[TMP6]], i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @p, i64 0, i64 1), align 8
-; NEWPM-NEXT:    ret void
-;
-bb:
-  %tmp = tail call i8* @strchr(i8* %arg, i32 %arg1)
-  store i8* %tmp, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @p, i64 0, i64 0), align 16
-  %tmp2 = icmp eq i8* %arg, null
-  br i1 %tmp2, label %bb5, label %bb3
-
-bb3:                                              ; preds = %bb
-  %tmp4 = tail call i8* @foo(i8* %arg)
-  br label %bb5
-
-bb5:                                              ; preds = %bb3, %bb
-  %tmp6 = phi i8* [ %tmp4, %bb3 ], [ null, %bb ]
-  store i8* %tmp6, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @p, i64 0, i64 1), align 8
-  ret void
-}
-
-declare i8* @strchr(i8*, i32)
-declare i8* @foo(i8*)