[Stack Alignment] emit warning instead of a hard error
authorManman Ren <mren@apple.com>
Mon, 4 Feb 2013 23:45:08 +0000 (23:45 +0000)
committerManman Ren <mren@apple.com>
Mon, 4 Feb 2013 23:45:08 +0000 (23:45 +0000)
Per discussion in rdar://13127907, we should emit a hard error only if
people write code where the requested alignment is larger than achievable
and assumes the low bits are zeros. A warning should be good enough when
we are not sure if the source code assumes the low bits are zeros.

rdar://13127907

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

lib/CodeGen/MachineFunction.cpp
test/CodeGen/ARM/alloc-no-stack-realign-error.ll

index 3d7d20d41601f18bf3aad740bcdc3888f0aa3dbd..4a9a62a7048b7c0f9852dabcaed9c4b55800d4c9 100644 (file)
@@ -479,11 +479,11 @@ static inline unsigned clampStackAlignment(bool ShouldClamp, unsigned PrefAlign,
   if (!ShouldClamp || PrefAlign <= StackAlign)
     return PrefAlign;
   if (Alloca && MinAlign > StackAlign)
-    Alloca->getParent()->getContext().emitError(Alloca,
-        "Requested Minimal Alignment exceeds the Stack Alignment!");
+    Alloca->getParent()->getContext().emitWarning(Alloca,
+        "Requested alignment exceeds the stack alignment!");
   else
     assert(MinAlign <= StackAlign &&
-           "Requested Minimal Alignment exceeds the Stack Alignment!");
+           "Requested alignment exceeds the stack alignment!");
   return StackAlign;
 }
 
index 96c00174dbaebda38904c97f4fa858330e5b9367..9b4d12ae8a82e71ae0119b371bef5bafe51d608f 100644 (file)
@@ -6,10 +6,10 @@
 ; If alignment for alloc is smaller than or equal to stack alignment, but the 
 ; preferred type alignment is bigger, the alignment will be clamped.
 ; If alignment for alloca is bigger than stack alignment, the compiler
-; will emit an error.
+; will emit a warning.
 define void @test(<16 x float>* noalias sret %agg.result) nounwind ssp {
 entry:
-; CHECK: Requested Minimal Alignment exceeds the Stack Alignment!
+; CHECK: warning: Requested alignment exceeds the stack alignment!
  %retval = alloca <16 x float>, align 16
  %0 = load <16 x float>* @T3_retval, align 16
  store <16 x float> %0, <16 x float>* %retval